From 8d0373facfaef0b800714a67cc992bcdad2a4b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoni=20Nu=C3=B1ez=20Romeu?= Date: Wed, 22 Jul 2026 13:09:29 +0200 Subject: [PATCH] Dockerization app --- .dockerignore | 12 ++++++++++++ Dockerfile | 12 ++++++++++++ docker-compose.yml | 8 ++++++++ nginx.conf | 15 +++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cd3b1f1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +node_modules +.git +.gitignore +dist +*.md +*.local +.env +.vscode +.idea +.gitattributes +bun.lock +bun.lockb diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..55c3b64 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:22-alpine AS build +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci +COPY . . +RUN npm run build + +FROM nginx:stable-alpine +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f0323ce --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + zlb: + build: + context: . + dockerfile: Dockerfile + ports: + - "35207:80" + restart: unless-stopped diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..6fd8380 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|woff2?|eot|ttf|otf|webp|avif|mp4|webm)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } +}