2017-09-24 19:44:49 +00:00
|
|
|
FROM mhart/alpine-node:latest
|
|
|
|
|
|
|
|
# Create app directory
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2020-05-02 05:35:33 +00:00
|
|
|
# Install app dependencies and add source files
|
|
|
|
COPY package.json yarn.lock tsconfig.json ./
|
|
|
|
COPY src/ ./src
|
|
|
|
RUN yarn install && yarn build && rm -f dist/*.map
|
2017-09-24 19:44:49 +00:00
|
|
|
|
2020-05-02 05:35:33 +00:00
|
|
|
# Second stage
|
|
|
|
FROM mhart/alpine-node:latest
|
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
# Copy artifacts
|
|
|
|
COPY --from=0 /usr/src/app/dist/ ./
|
|
|
|
COPY --from=0 /usr/src/app/node_modules ./node_modules
|
2020-05-02 06:36:36 +00:00
|
|
|
COPY env.json src/responses.json ./
|
|
|
|
COPY src/responses ./responses/
|
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" ]
|