2021-10-23 13:18:58 +02:00
|
|
|
### STAGE 0: Build client ###
|
2024-01-20 00:54:41 +01:00
|
|
|
FROM node:20-alpine AS build
|
2021-08-18 00:01:11 +02:00
|
|
|
WORKDIR /client
|
|
|
|
COPY /client /client
|
2022-05-25 17:26:21 +02:00
|
|
|
RUN npm ci && npm cache clean --force
|
2021-08-18 00:01:11 +02:00
|
|
|
RUN npm run generate
|
|
|
|
|
2021-10-23 13:18:58 +02:00
|
|
|
### STAGE 1: Build server ###
|
2024-01-20 00:54:41 +01:00
|
|
|
FROM node:20-alpine
|
2022-09-11 22:35:06 +02:00
|
|
|
|
2021-08-18 00:01:11 +02:00
|
|
|
ENV NODE_ENV=production
|
2023-07-17 14:48:23 +02:00
|
|
|
|
2022-06-02 07:55:01 +02:00
|
|
|
RUN apk update && \
|
2024-09-29 08:22:39 +02:00
|
|
|
apk add --no-cache --update \
|
|
|
|
curl \
|
|
|
|
tzdata \
|
|
|
|
ffmpeg \
|
|
|
|
make \
|
|
|
|
gcompat \
|
|
|
|
python3 \
|
|
|
|
g++ \
|
|
|
|
tini \
|
|
|
|
unzip
|
2022-06-02 07:55:01 +02:00
|
|
|
|
2021-08-18 00:01:11 +02:00
|
|
|
COPY --from=build /client/dist /client/dist
|
2022-06-02 07:55:01 +02:00
|
|
|
COPY index.js package* /
|
2021-08-18 00:01:11 +02:00
|
|
|
COPY server server
|
2022-06-02 07:55:01 +02:00
|
|
|
|
2024-09-29 08:22:39 +02:00
|
|
|
ARG TARGETPLATFORM
|
|
|
|
|
|
|
|
ENV NUSQLITE3_DIR="/usr/local/lib/nusqlite3"
|
|
|
|
ENV NUSQLITE3_PATH="${NUSQLITE3_DIR}/libnusqlite3.so"
|
|
|
|
|
|
|
|
RUN case "$TARGETPLATFORM" in \
|
|
|
|
"linux/amd64") \
|
|
|
|
curl -L -o /tmp/library.zip "https://github.com/mikiher/nunicode-sqlite/releases/download/v1.0/libnusqlite3-linux-x64.zip" ;; \
|
|
|
|
"linux/arm64") \
|
|
|
|
curl -L -o /tmp/library.zip "https://github.com/mikiher/nunicode-sqlite/releases/download/v1.0/libnusqlite3-linux-arm64.zip" ;; \
|
|
|
|
*) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \
|
|
|
|
esac && \
|
|
|
|
unzip /tmp/library.zip -d $NUSQLITE3_DIR && \
|
|
|
|
rm /tmp/library.zip
|
|
|
|
|
2022-05-21 01:15:54 +02:00
|
|
|
RUN npm ci --only=production
|
2022-06-02 07:55:01 +02:00
|
|
|
|
2023-07-09 18:39:15 +02:00
|
|
|
RUN apk del make python3 g++
|
|
|
|
|
2021-08-18 00:01:11 +02:00
|
|
|
EXPOSE 80
|
2023-07-20 23:59:46 +02:00
|
|
|
|
2024-01-03 21:55:43 +01:00
|
|
|
ENTRYPOINT ["tini", "--"]
|
2023-03-09 18:47:48 +01:00
|
|
|
CMD ["node", "index.js"]
|