-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
23 lines (21 loc) · 905 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
FROM node:20-alpine AS base
WORKDIR /app
RUN apk --no-cache add ca-certificates
FROM base AS builder
RUN apk --no-cache add python3-dev musl-dev make g++ git
COPY package.json .
COPY yarn.lock .
RUN yarn --frozen-lockfile --non-interactive
COPY . .
# Build app, trim node_modules dependencies, and remove tests
RUN yarn build && \
mv yarnclean .yarnclean && yarn --frozen-lockfile --non-interactive --production && \
find dist/ -name '*.spec.js*' -exec rm {} +
FROM base AS release
ENV NODE_ENV production
RUN mkdir runtime && echo '{}' > runtime/config.json && chown -R 1000:1000 .
COPY --from=builder --chown=1000:1000 /app/dist ./dist
COPY --from=builder --chown=1000:1000 /app/node_modules ./node_modules
COPY --from=builder --chown=1000:1000 /app/chips ./chips
USER 1000:1000
CMD ["sh", "-c", "node node_modules/typeorm/cli migration:run -d dist/clients/database.js && node dist/index.js"]