2022-02-11 22:05:08 +01:00
|
|
|
# !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!!
|
2024-07-16 23:52:55 +03:00
|
|
|
FROM node:20.15.1-alpine
|
2018-06-10 15:06:52 -04:00
|
|
|
|
2024-07-13 11:14:32 +03:00
|
|
|
# Configure system dependencies
|
|
|
|
RUN apk add --no-cache --virtual .build-dependencies \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
g++ \
|
|
|
|
gcc \
|
|
|
|
libtool \
|
|
|
|
make \
|
|
|
|
nasm \
|
|
|
|
libpng-dev \
|
|
|
|
python3
|
|
|
|
|
2018-06-10 15:06:52 -04:00
|
|
|
# Create app directory
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2022-12-02 18:15:03 +01:00
|
|
|
# Bundle app source
|
|
|
|
COPY . .
|
|
|
|
|
2019-10-15 21:53:46 +02:00
|
|
|
COPY server-package.json package.json
|
2018-06-10 15:06:52 -04:00
|
|
|
|
2024-07-13 11:40:52 +03:00
|
|
|
# Copy TypeScript build artifacts into the original directory structure.
|
|
|
|
RUN ls
|
|
|
|
RUN cp -R build/src/* src/.
|
2024-08-07 23:25:22 +03:00
|
|
|
|
|
|
|
# Copy the healthcheck
|
|
|
|
RUN cp build/docker_healthcheck.js .
|
|
|
|
RUN rm docker_healthcheck.ts
|
|
|
|
|
2024-07-13 11:45:20 +03:00
|
|
|
RUN rm -r build
|
2024-07-13 11:40:52 +03:00
|
|
|
|
2018-11-30 05:41:45 +00:00
|
|
|
# Install app dependencies
|
|
|
|
RUN set -x \
|
2022-12-02 18:15:03 +01:00
|
|
|
&& npm install \
|
|
|
|
&& apk del .build-dependencies \
|
|
|
|
&& npm run webpack \
|
|
|
|
&& npm prune --omit=dev \
|
2022-12-12 21:39:10 +01:00
|
|
|
&& cp src/public/app/share.js src/public/app-dist/. \
|
2022-12-25 11:58:24 +01:00
|
|
|
&& cp -r src/public/app/doc_notes src/public/app-dist/. \
|
2024-07-13 22:10:57 +03:00
|
|
|
&& rm -rf src/public/app \
|
|
|
|
&& rm src/services/asset_path.ts
|
2018-06-10 15:06:52 -04:00
|
|
|
|
2023-02-17 16:24:47 +01:00
|
|
|
# Some setup tools need to be kept
|
|
|
|
RUN apk add --no-cache su-exec shadow
|
2022-05-21 13:25:59 +08:00
|
|
|
|
|
|
|
# Add application user and setup proper volume permissions
|
|
|
|
RUN adduser -s /bin/false node; exit 0
|
2020-11-15 20:51:47 +01:00
|
|
|
|
2022-05-21 13:25:59 +08:00
|
|
|
# Start the application
|
2018-06-10 15:06:52 -04:00
|
|
|
EXPOSE 8080
|
2022-05-21 13:25:59 +08:00
|
|
|
CMD [ "./start-docker.sh" ]
|
2022-06-18 17:10:26 +03:00
|
|
|
|
2023-03-15 00:01:25 +00:00
|
|
|
HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js
|