-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (27 loc) · 865 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
FROM node:20.10-alpine AS build
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /usr/app
COPY .npmrc ./
COPY package* ./
COPY setupTests.js ./
RUN npm ci -d
COPY [".babelrc", ".eslint*", ".prettierrc", "./"]
COPY src src
ARG BUILD_ID=unknown
ENV BUILD_ID=${BUILD_ID}
RUN echo "Build with BUILD_ID: $BUILD_ID"
RUN npm run lint && \
npm run test:ci && \
npm run build && \
npm prune --production
FROM node:20.10.0-alpine
WORKDIR /usr/app
RUN addgroup -g 1234 campudus && \
adduser -u 5678 -S campudus -G campudus -s /bin/bash -h /usr/app campudus && \
chown -R campudus:campudus /usr/app
COPY --from=build /usr/app/node_modules /usr/app/node_modules
COPY --from=build /usr/app/package.json /usr/app/package.json
COPY --from=build /usr/app/out /usr/app/out
USER campudus
CMD [ "npm", "run", "start"]