forked from AnubisLMS/Anubis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
38 lines (25 loc) · 836 Bytes
/
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
FROM node:16-alpine
# This disables webpack source maps from being created in the build step
ENV GENERATE_SOURCEMAP=false
WORKDIR /opt/app
COPY package.json yarn.lock /opt/app/
RUN yarn install --frozen-lockfile
COPY . .
RUN set -eux; \
yarn run build; \
rm -rf node_modules src public package.json yarn.lock; \
find /usr /home -depth -name '.cache' -exec 'rm' '-rf' '{}' ';'
FROM node:16-alpine
WORKDIR /opt/app
RUN set -eux; \
apk add --no-cach tini; \
yarn global add serve; \
find / -depth -name '.cache' -exec 'rm' '-rf' '{}' ';'
COPY --from=0 /opt/app/build /opt/app/build
ARG GIT_TAG=latest
ENV GIT_TAG=${GIT_TAG}
RUN set -eux; \
sed -i "s/GIT_TAG_PLACEHOLDER/${GIT_TAG}/" $(find /opt/app/build -type f)
USER nobody
ENTRYPOINT ["tini", "--"]
CMD ["serve", "-s", "build", "-l", "3000"]