journal-media-vue/containers/Dockerfile
gcch ad01868a9f
Some checks failed
ci/woodpecker/push/publish_instable Pipeline failed
2025-03-05
2025-03-05 09:10:21 +01:00

53 lines
1.8 KiB
Docker

FROM oven/bun:1 AS base
WORKDIR /usr/src/app
# Définis les variables d'environnement.
ARG VERSION="0.1"
# Installe les dépendances de développement.
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lock /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# Installe les dépendances de production.
RUN mkdir -p /temp/prod
COPY package.json bun.lock /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
# Récupère node_modules et les fichiers du projet.
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules/ node_modules
COPY . .
# Compile le projet.
ENV NODE_ENV=production
RUN bun --bun vite build
# Créé le nécessaire pour Angie, le proxy inversé servant l'application.
FROM docker.angie.software/angie:minimal AS release
COPY --from=prerelease /usr/src/app/dist/ /usr/share/angie/html/
COPY containers/angie/default.conf /etc/angie/http.d/default.conf
# Met en place les métadonnées OCI.
LABEL org.opencontainers.image.title=journal-media-vue \
org.opencontainers.image.description="A modern client-server application for the Soulseek file sharing network" \
org.opencontainers.image.authors="gcch" \
org.opencontainers.image.vendor="gcch" \
org.opencontainers.image.licenses=AGPL-3.0
# org.opencontainers.image.url=https://slskd.org \
# org.opencontainers.image.source=https://github.com/slskd/slskd \
# org.opencontainers.image.documentation=https://github.com/slskd/slskd \
# org.opencontainers.image.version=$VERSION \
# org.opencontainers.image.revision=$REVISION \
# org.opencontainers.image.created=$BUILD_DATE
# Démarre Angie.
EXPOSE 80
CMD ["angie", "-g", "daemon off;"]
# Met en place une vérification périodique de la bonne santé du conteneur.
HEALTHCHECK \
--interval=60s \
--timeout=3s \
--start-period=5s \
--retries=3 \
CMD wget -q -O - http://localhost:80/