-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathDockerfile
67 lines (54 loc) · 1.9 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
FROM node:18.8-alpine as compiler
ARG version_number
ARG heroku_app_name
ARG FRONT_BUILD_NODE_OPTIONS="--max-old-space-size=4096"
RUN apk add --no-cache openssh-client \
&& mkdir ~/.ssh && ssh-keyscan github.com > ~/.ssh/known_hosts
RUN apk add --no-cache --virtual native-deps \
g++ gcc libgcc libstdc++ linux-headers make automake autoconf libtool python3 \
util-linux \
git \
openssh \
shadow \
musl-dev \
nasm \
tiff \
jpeg \
zlib \
zlib-dev \
vips \
vips-dev \
file \
pkgconf
RUN apk add --no-cache tini
WORKDIR /app
COPY ./package-lock.json /app/package-lock.json
COPY ./package.json /app/package.json
RUN git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
RUN npm ci
COPY ./src /app/src
COPY ./static /app/static
COPY ./entrypoint.sh /app/entrypoint.sh
COPY ./tsconfig.json /app/tsconfig.json
COPY ./.babelrc.json /app/.babelrc.json
RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build
RUN npm prune --production --ignore-scripts
FROM node:18.8-alpine
WORKDIR /app
RUN rm -rf \
/usr/local/lib/node_modules/npm/ \
/usr/local/bin/npm \
/usr/local/bin/npx \
/usr/local/bin/corepack \
/usr/local/bin/yarn \
/usr/local/bin/yarnpkg \
/opt/yarn-*
COPY --from=compiler /sbin/tini /sbin/tini
COPY --from=compiler /app/package.json /app/package.json
COPY --from=compiler /app/package-lock.json /app/package-lock.json
COPY --from=compiler /app/node_modules /app/node_modules
COPY --from=compiler /app/lib /app/lib
COPY --from=compiler /app/static /app/static
COPY --from=compiler /app/entrypoint.sh /app/entrypoint.sh
VOLUME [ "/data" ]
ENTRYPOINT ["/sbin/tini", "--", "/app/entrypoint.sh"]