forked from CivicActions/civicactions.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (49 loc) · 1.29 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# Node environment (used for sandboxes also)
#
FROM node:12.8 as env
WORKDIR /usr/src/app
ENV PATH=/usr/src/app/node_modules/.bin/:${PATH}
USER root
ARG UID=1000
RUN usermod -u ${UID} -o node
RUN chown -R node /usr/src/app /home
USER node
#
# Build site
#
FROM env as app
ARG GATSBY_JAZZ_URL
COPY --chown=node package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY --chown=node . .
RUN yarn lint-code
# TODO: Fix warnings and add eslint-code here also.
RUN yarn lint-styles
RUN yarn build
RUN yarn test
#
# Compress site files
# TODO: When brotli is added to stable Alpine release, move back to tagged base image.
#
FROM alpine:edge as appz
RUN apk add gzip brotli --no-cache
COPY --from=app /usr/src/app/public /srv
RUN find /srv -type f -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
-o -name '*.json' -o -name '*.xml' -o -name '*.svg' -o -name '*.txt' \) \
-exec brotli -f --best {} \+ -exec gzip -f --best -k {} \+
#
# Lossless image compression
#
FROM bardiir/auto-caesium:latest as appzz
COPY --from=appz /srv /caesium
RUN /caesiumbin/entrypoint.sh
#
# Package site into web server
#
FROM civicactions/caddy-docker-build:v1.0.3.2
ENV ENV dev
# Install default configuration files.
COPY Caddyfile* /etc/
# Install application from appzz stage.
COPY --from=appzz /caesium /srv