web-app-chess: refactor runtime & entrypoint

- Move entrypoint to files/ and deploy via copy
- Parameterize APP_KEY_FILE, data dir, and entrypoint paths
- Require explicit PORT/PG envs (remove fallbacks)
- Drop stray header from config/main.yml
- Dockerfile: use templated data dir & entrypoint; keep node user
- Compose: set custom image, adjust volume mapping
- env: derive APP_SCHEME from WEB_PROTOCOL; NODE_ENV from ENVIRONMENT
- tasks: add 01_core and simplify main to include it

Ref: https://chatgpt.com/share/68b851c5-4dd8-800f-8e9e-22b985597b8f
This commit is contained in:
2025-09-03 16:34:04 +02:00
parent df122905eb
commit a1130e33d7
9 changed files with 38 additions and 38 deletions

View File

@@ -21,8 +21,6 @@ RUN yarn install --frozen-lockfile && yarn build
# Stage 2: runtime
FROM node:{{ CHESS_VERSION }}
ENV NODE_ENV=production
ENV PORT={{ container_port }}
WORKDIR /app
# Minimal runtime packages + dumb-init
@@ -34,14 +32,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY --from=build /src /app
# Create data dir for signing keys & cache
RUN mkdir -p /app/data && chown -R node:node /app
VOLUME ["/app/data"]
RUN mkdir -p {{ CHESS_APP_DATA_DIR }} && chown -R node:node /app
VOLUME ["{{ CHESS_APP_DATA_DIR }}"]
# Entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
COPY {{ CHESS_ENTRYPOINT_REL }} {{ CHESS_ENTRYPOINT_INT }}
RUN chmod +x {{ CHESS_ENTRYPOINT_INT }}
USER node
EXPOSE {{ container_port }}
ENTRYPOINT ["dumb-init", "--"]
CMD ["docker-entrypoint.sh"]
CMD ["{{ CHESS_ENTRYPOINT_INT }}"]