Add Docker and Gitea workflow configurations for Talks slides deployment
- Introduced .dockerignore to exclude unnecessary files from Docker builds. - Added build-and-push.yaml workflow for automated image building and Helm chart deployment on changes to specific paths. - Created Dockerfile for building a static site with Nginx, including configuration for serving slides. - Established Helm chart structure in talks-slides-dist for managing deployment configurations and resources. - Removed outdated GitHub Actions workflows to streamline CI/CD processes.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Image statique : build npm (VitePress + Slidev) puis nginx non-root.
|
||||
FROM node:22-bookworm-slim AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
# npm 10 (image officielle) et npm 11 (lock généré localement) divergent sur la validation du lock ; `install` reste déterministe via package-lock.
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Même arborescence que tools/static-preview.mjs : portail à la racine, decks sous slides/<slug>/
|
||||
RUN set -eux \
|
||||
&& mkdir -p /opt/site \
|
||||
&& cp -a dist-portal/. /opt/site/ \
|
||||
&& for d in dist-*; do \
|
||||
[ -d "$d" ] || continue; \
|
||||
[ "$d" = "dist-portal" ] && continue; \
|
||||
slug="${d#dist-}"; \
|
||||
mkdir -p "/opt/site/slides/${slug}"; \
|
||||
cp -a "${d}/." "/opt/site/slides/${slug}/"; \
|
||||
done
|
||||
|
||||
FROM nginxinc/nginx-unprivileged:stable-alpine
|
||||
|
||||
ARG UID=101
|
||||
ARG GID=101
|
||||
|
||||
USER root
|
||||
COPY --from=builder /opt/site /usr/share/nginx/html
|
||||
COPY server/nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
RUN chown -R "${UID}:${GID}" /usr/share/nginx/html
|
||||
|
||||
USER ${UID}
|
||||
EXPOSE 8080
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -0,0 +1,22 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Portail VitePress (fichiers statiques + clean URLs)
|
||||
location / {
|
||||
try_files $uri $uri/ $uri.html =404;
|
||||
}
|
||||
|
||||
# Slidev : /slides/<slug> ou /slides/<slug>/ → première planche (comme static-preview.mjs)
|
||||
# $http_host conserve le port client (reverse proxy, docker -p host:8080).
|
||||
location ~ ^/slides/([^/]+)/?$ {
|
||||
return 302 $scheme://$http_host/slides/$1/1$is_args$args;
|
||||
}
|
||||
|
||||
# Decks Slidev : assets et routes SPA (/1, /2, …)
|
||||
location ~ ^/slides/(?<slug>[^/]+)(?<rest>/.*)$ {
|
||||
try_files $uri $uri/ /slides/$slug/index.html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user