GIthub token
This commit is contained in:
37
Dockerfile
37
Dockerfile
@@ -1,7 +1,7 @@
|
|||||||
# Image Node 22
|
# Image Node 22
|
||||||
FROM node:22-alpine
|
FROM node:22-alpine
|
||||||
|
|
||||||
# Outils utiles pour certaines dépendances natives et git
|
# Outils utiles pour dépendances natives et git
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
git \
|
git \
|
||||||
python3 \
|
python3 \
|
||||||
@@ -10,10 +10,39 @@ RUN apk add --no-cache \
|
|||||||
bash \
|
bash \
|
||||||
libc6-compat
|
libc6-compat
|
||||||
|
|
||||||
# Dossier persistant où l'install déposera l'app
|
# Variables npm et git pour des installs plus stables et verbeuses si besoin
|
||||||
|
ENV npm_config_loglevel=warn \
|
||||||
|
npm_config_audit=false \
|
||||||
|
npm_config_fund=false \
|
||||||
|
NPM_CONFIG_FOREGROUND_SCRIPTS=true \
|
||||||
|
GIT_TERMINAL_PROMPT=0
|
||||||
|
|
||||||
|
# Optionnel: passer un token pour éviter les rate limits GitHub pendant le build
|
||||||
|
# Utilise: docker build --build-arg GITHUB_TOKEN=ghp_xxx .
|
||||||
|
ARG GITHUB_TOKEN
|
||||||
|
|
||||||
|
# Installer l outil une fois pour toutes afin d éviter npx à chaque run
|
||||||
|
# Si GITHUB_TOKEN est fourni, on l injecte temporairement dans l URL git pendant l install,
|
||||||
|
# puis on nettoie la config. Note: le token peut apparaître dans l historique de layer.
|
||||||
|
RUN set -eux; \
|
||||||
|
if [ -n "${GITHUB_TOKEN:-}" ]; then \
|
||||||
|
git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"; \
|
||||||
|
fi; \
|
||||||
|
npm i -g github:adapt-security/at-utils@0.10.0; \
|
||||||
|
if [ -n "${GITHUB_TOKEN:-}" ]; then \
|
||||||
|
git config --global --unset-all url."https://${GITHUB_TOKEN}@github.com/".insteadof || true; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Dossier de travail persistant où l install déposera l app
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
# Port utilisé par l'UI d'installation et par l'app
|
# Préparer les permissions quand on utilisera l utilisateur node
|
||||||
|
RUN mkdir -p /data && chown -R node:node /data
|
||||||
|
|
||||||
|
# Exposer le port utilisé par l UI d installation et par l app
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
# Pas d'ENTRYPOINT: on pilote via 'command' dans docker-compose
|
# Passer en utilisateur non privilégié
|
||||||
|
USER node
|
||||||
|
|
||||||
|
# Pas d ENTRYPOINT: piloté via docker-compose command
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- STATE=${STATE:-run} # valeur par défaut = run
|
- STATE=${STATE:-run} # valeur par défaut = run
|
||||||
|
- GITHUB_TOKEN=${GITHUB_TOKEN:-}
|
||||||
volumes:
|
volumes:
|
||||||
- app-data:/data
|
- app-data:/data
|
||||||
command: >
|
command: >
|
||||||
|
|||||||
Reference in New Issue
Block a user