2021-10-22 03:55:04 -04:00
|
|
|
FROM node:16-alpine AS build
|
2017-09-24 15:44:49 -04:00
|
|
|
|
|
|
|
# Create app directory
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2020-05-02 01:35:33 -04:00
|
|
|
# Install app dependencies and add source files
|
|
|
|
COPY package.json yarn.lock tsconfig.json ./
|
|
|
|
COPY src/ ./src
|
2022-01-09 20:00:35 -05:00
|
|
|
RUN yarn install --frozen-lockfile && yarn build && rm -f dist/*.map
|
2017-09-24 15:44:49 -04:00
|
|
|
|
2020-05-02 01:35:33 -04:00
|
|
|
# Second stage
|
2021-10-22 03:55:04 -04:00
|
|
|
FROM node:16-alpine
|
2020-05-02 01:35:33 -04:00
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
# Copy artifacts
|
2020-07-26 23:54:03 -04:00
|
|
|
COPY --from=build /usr/src/app/dist/ ./
|
|
|
|
COPY --from=build /usr/src/app/node_modules ./node_modules
|
2020-05-02 02:36:36 -04:00
|
|
|
COPY env.json src/responses.json ./
|
|
|
|
COPY src/responses ./responses/
|
2017-09-24 15:44:49 -04:00
|
|
|
|
2017-10-01 16:46:05 -04:00
|
|
|
RUN addgroup -S app -g 50000 && \
|
2018-01-20 00:11:52 -05:00
|
|
|
adduser -S -g app -u 50000 app && \
|
|
|
|
mkdir /data && chown app:app /data/
|
|
|
|
|
2017-10-01 16:46:05 -04:00
|
|
|
USER app
|
|
|
|
|
2020-05-02 01:35:33 -04:00
|
|
|
ENTRYPOINT [ "node", "server.js" ]
|