diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4a2c920 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,50 @@ +# Dépendances +node_modules +.pnpm-store + +# Fichiers de build +dist +build + +# Environnement +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Fichiers d'éditeur +.idea +.vscode +*.swp +*.swo + +# Fichiers système +.DS_Store +Thumbs.db + +# Logs +npm-debug.log* +pnpm-debug.log* +yarn-debug.log* +yarn-error.log* +logs +*.log + +# Cache +.astro +.eslintcache +.cache + +# Tests +coverage +.nyc_output + +# Fichiers Docker (pour éviter la récursion) +Dockerfile +.dockerignore +docker-compose* + +# Fichiers Git +.git +.gitignore diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..982c842 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM node:20-alpine AS build + +RUN corepack enable && corepack prepare pnpm@9.15.0 --activate + +WORKDIR /app + +COPY pnpm-lock.yaml package.json ./ + +RUN pnpm install --frozen-lockfile + +COPY . . + +RUN pnpm build + +FROM nginx:1.28.0-alpine3.21-slim AS runtime + +COPY ./nginx.conf /etc/nginx/nginx.conf +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 8080 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..43ead33 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,31 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 8080; + server_name _; + + root /usr/share/nginx/html; + index index.html index.htm; + include /etc/nginx/mime.types; + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + error_page 404 /404.html; + location = /404.html { + root /usr/share/nginx/html; + internal; + } + + location / { + try_files $uri $uri/index.html =404; + } + } +}