2022-12-31 09:05:32 +00:00
|
|
|
FROM node:18-alpine AS build
|
2017-09-24 19:44:49 +00:00
|
|
|
|
|
|
|
# Create app directory
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2020-05-02 05:35:33 +00:00
|
|
|
# Install app dependencies and add source files
|
2022-10-13 00:02:14 +00:00
|
|
|
COPY package.json env.json yarn.lock tsconfig.json bundle.sh *.js *.mjs ./
|
2022-09-14 09:04:27 +00:00
|
|
|
COPY ./src ./src
|
|
|
|
RUN yarn install --frozen-lockfile && sh -e ./bundle.sh
|
2017-09-24 19:44:49 +00:00
|
|
|
|
2020-05-02 05:35:33 +00:00
|
|
|
# Second stage
|
2022-12-31 09:05:32 +00:00
|
|
|
FROM node:18-alpine
|
2020-05-02 05:35:33 +00:00
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
# Copy artifacts
|
2020-07-27 03:54:03 +00:00
|
|
|
COPY --from=build /usr/src/app/dist/ ./
|
2017-09-24 19:44:49 +00:00
|
|
|
|
2017-10-01 20:46:05 +00:00
|
|
|
RUN addgroup -S app -g 50000 && \
|
2018-01-20 05:11:52 +00:00
|
|
|
adduser -S -g app -u 50000 app && \
|
|
|
|
mkdir /data && chown app:app /data/
|
|
|
|
|
2017-10-01 20:46:05 +00:00
|
|
|
USER app
|
|
|
|
|
2020-05-02 05:35:33 +00:00
|
|
|
ENTRYPOINT [ "node", "server.js" ]
|