-
Notifications
You must be signed in to change notification settings - Fork 26
/
Dockerfile
92 lines (69 loc) · 2.23 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
################################
# Base
################################
FROM node:18 AS base
LABEL maintainer="[email protected]"
WORKDIR /app
# Install dependencies and remove apt cache
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
# Change git URL because network is blocking git protocol...
RUN git config --global url."https://".insteadOf git://
RUN git config --global url."https://github.com/".insteadOf [email protected]:
COPY .eslintrc.js \
.prettierrc \
custom.d.ts \
tsconfig.json \
jest.config.js \
babel.config.js \
package.json \
package-lock.json \
app.base.json \
app.amsterdam.json \
/app/
RUN npm install
COPY assets /app/assets
COPY internals /app/internals
COPY src /app/src
ARG FRONTEND_TAG
ENV FRONTEND_TAG ${FRONTEND_TAG}
ARG DOMAIN_TAG
ENV DOMAIN_TAG ${DOMAIN_TAG}
ARG BUILD_ENV
ENV BUILD_ENV ${BUILD_ENV}
RUN npm run build
ARG BUILD_NUMBER=0
RUN echo "build ${BUILD_NUMBER} - `date`" > /app/build/version.txt
################################
# Deploy
################################
FROM nginx:stable-alpine
RUN apk add --no-cache jq nodejs yarn
RUN yarn add @exodus/schemasafe lodash
COPY --from=base /app/build/. /usr/share/nginx/html/
COPY nginx.conf /etc/nginx/nginx.conf
COPY default.conf /etc/nginx/conf.d/
COPY start.sh /usr/local/bin/start.sh
RUN chmod +x /usr/local/bin/start.sh
COPY app.base.json /app.base.json
COPY app.amsterdam.json /app.amsterdam.json
COPY internals/schemas/app.schema.json /internals/schemas/app.schema.json
COPY internals/scripts/validate-config.js /internals/scripts/validate-config.js
COPY internals/scripts/inject-config.js /internals/scripts/inject-config.js
COPY internals/scripts/helpers/config.js /internals/scripts/helpers/config.js
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
# Add non-privileged user
RUN adduser -D -u 1001 appuser
# Make sure appuser can change files that change in runtime
RUN touch /run/nginx.pid && \
chown -R appuser \
/run/nginx.pid \
/var/cache/nginx \
/usr/share/nginx/html/index.html \
/usr/share/nginx/html/manifest.json
USER appuser
CMD ["/usr/local/bin/start.sh"]
EXPOSE 8080