Files
WhatIDo/Dockerfile
T

22 lines
868 B
Docker

FROM node:20-alpine
ENV TZ=Europe/Moscow
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install --omit=dev
COPY . .
RUN mkdir -p uploads certs
RUN set -e; \
V="v$(cut -d. -f1-2 /etc/alpine-release)"; \
i=1; \
until apk add --no-cache openssl; do \
echo "apk add failed on attempt $i, switching to backup mirror..."; \
printf "https://mirrors.edge.kernel.org/alpine/%s/main\nhttps://mirrors.edge.kernel.org/alpine/%s/community\n" "$V" "$V" > /etc/apk/repositories; \
i=$((i+1)); \
if [ $i -gt 6 ]; then echo "apk add failed after 6 attempts"; exit 1; fi; \
sleep 5; \
done && \
openssl req -x509 -nodes -newkey rsa:2048 -days 3650 \
-keyout certs/key.pem -out certs/cert.pem \
-subj "/CN=whatido.local" -addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
EXPOSE 3003 3443
CMD ["node", "server.js"]