2022-12-01 19:55:41 +03:00
|
|
|
#
|
|
|
|
# Build
|
|
|
|
#
|
2024-04-04 13:56:51 +03:00
|
|
|
FROM node:18.20-slim AS builder
|
2016-03-02 07:13:17 +03:00
|
|
|
|
|
|
|
WORKDIR /srv/node
|
2022-12-01 19:55:41 +03:00
|
|
|
COPY package.json yarn.lock /srv/node/
|
|
|
|
|
2024-01-09 21:00:59 +03:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git && rm -rf /var/lib/apt/lists/
|
2022-12-01 19:55:41 +03:00
|
|
|
RUN yarn install --pure-lockfile
|
|
|
|
|
|
|
|
#
|
|
|
|
# Install
|
|
|
|
#
|
2024-04-04 13:56:51 +03:00
|
|
|
FROM node:18.20-slim
|
2022-12-01 19:55:41 +03:00
|
|
|
|
|
|
|
ARG app_uid=9500
|
|
|
|
ARG app_dir=/app
|
|
|
|
|
|
|
|
RUN useradd -u ${app_uid} -d /home/app -m -s /sbin/nologin app
|
|
|
|
# The WORKDIR directive set the ownership of the work directory to root instead
|
|
|
|
# of USER unless the "buildkit" feature is enabled. To make sure the work
|
|
|
|
# directory is owned by the proper user for everybody, we manually set the
|
|
|
|
# ownership.
|
|
|
|
RUN mkdir -p ${app_dir} && chown ${app_uid}:${app_uid} ${app_dir}
|
|
|
|
|
|
|
|
USER ${app_uid}:${app_uid}
|
|
|
|
|
|
|
|
WORKDIR ${app_dir}
|
2017-01-27 01:33:43 +03:00
|
|
|
|
2022-12-01 19:55:41 +03:00
|
|
|
COPY --chown=${app_uid}:${app_uid} . ${app_dir}/
|
2017-01-31 20:30:50 +03:00
|
|
|
|
2016-03-02 07:13:17 +03:00
|
|
|
# Replace the local node_modules with the ones we installed above.
|
|
|
|
RUN rm -rf node_modules
|
2022-12-01 19:55:41 +03:00
|
|
|
COPY --from=builder --chown=${app_uid}:${app_uid} /srv/node/node_modules ${app_dir}/node_modules
|
2016-03-02 07:13:17 +03:00
|
|
|
|
|
|
|
ENV SERVER_HOST 0.0.0.0
|
|
|
|
ENV SERVER_PORT 4000
|
|
|
|
|
2017-08-30 20:50:00 +03:00
|
|
|
CMD yarn start
|