-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
39 lines (26 loc) · 1.12 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
# alpine3.18 is used because of the issue with 'sharp' https://github.com/nodejs/docker-node/issues/2009#issuecomment-1855547128
FROM --platform=linux/amd64 node:20-alpine3.18
# Set work directory
WORKDIR /service
# Yarn will not install any package listed in devDependencies if the NODE_ENV
# environment variable is set to production. Use this flag to instruct Yarn to
# ignore NODE_ENV and take its production-or-not status from this flag instead.
ENV NODE_ENV=production
# Note layers should be ordered from less to more likely to change.
# Update & install required packages
RUN apk add --update bash curl;
# Install dependencies
COPY yarn.lock yarn.lock
COPY package.json package.json
COPY serve/yarn.lock serve/yarn.lock
COPY serve/package.json serve/package.json
#RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --frozen-lockfile
RUN yarn install --frozen-lockfile --network-timeout 1000000
# Copy app source
COPY . .
# Build and store webpack cache
RUN --mount=type=cache,target=./.webpack-cache yarn build
RUN rm -rf src/
RUN rm -rf node_modules/
EXPOSE 2200
CMD ["yarn", "run", "static"]