forked from drblgn/as_api_test
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdockerfile
More file actions
31 lines (24 loc) · 827 Bytes
/
dockerfile
File metadata and controls
31 lines (24 loc) · 827 Bytes
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
FROM node:21-alpine
# Print build information (ARGS are automatic, and target can be set)
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN printf "I am running on ${BUILDPLATFORM}, building for ${TARGETPLATFORM}\n$(uname -a)\n"
# Copy needed files
USER node
RUN mkdir -p /home/node/app
WORKDIR /home/node/app
COPY --chown=node:node package.json package-lock.json tsconfig.json LICENSE ./
COPY --chown=node:node src ./src/
RUN chown -R node:node /home/node/app
# Install, build, and remove source code & dev packages
RUN npm install && \
npm run build && \
rm -rf src tsconfig.json && \
npm prune --production
# If you are building your code for production
# RUN npm ci --only=production
# Bundle app source and chown to non root
COPY --chown=node:node . .
# Expose app port binding
EXPOSE 3000
CMD [ "npm", "start" ]