forked from njfamirm/decap-cms-github-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (36 loc) · 991 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
39
40
41
42
43
44
45
46
47
48
49
50
ARG NODE_IMAGE=docker.io/library/node:20-alpine
FROM $NODE_IMAGE as builder
WORKDIR /app
ENV NODE_ENV production
# Install dependencies
COPY package.json *.lock ./
RUN if [ -f *.lock ]; then \
yarn install --frozen-lockfile --non-interactive --production false; \
else \
yarn install --non-interactive --production false; \
fi;
COPY . .
RUN set -ex;\
yarn build;\
cd dist; pwd; ls -lahF;
# Clean devDependencies
RUN set -ex;\
rm -rf node_modules;\
yarn install --frozen-lockfile --non-interactive --production true;
# ---
FROM $NODE_IMAGE as app
WORKDIR /app
CMD ["yarn", "serve"]
ENV NODE_ENV production
ENV NODE_OPTIONS --enable-source-maps
# ENV ALWATR_DEBUG 1
ENV HOST 0.0.0.0
ENV PORT 80
EXPOSE 80
# Copy all deps from last stage
COPY --from=builder /app/node_modules ./node_modules
# Copy builded files from last stage
ARG PACKAGE_SOURCE
COPY --from=builder /app/package.json ./
COPY --from=builder /app/dist ./dist
RUN pwd; ls -lAhF;