diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c6c2f7a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +node_modules +dist +.git +.gitignore +.claude +.planning +.env +.env.* +*.log +npm-debug.log* +.DS_Store +.vscode +.idea +Dockerfile +.dockerignore +docker-compose.yml +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..48ad4fd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# syntax=docker/dockerfile:1.7 + +FROM node:20-alpine AS deps +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci + +FROM node:20-alpine AS build +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +RUN npm run build + +FROM nginx:1.27-alpine AS runtime +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..51a00ea --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + frontend: + build: + context: . + dockerfile: Dockerfile + image: elcsa-frontend:latest + container_name: elcsa-frontend + ports: + - "3000:80" + restart: unless-stopped diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..aab1c08 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + gzip on; + gzip_comp_level 6; + gzip_min_length 1024; + gzip_types text/plain text/css application/javascript application/json image/svg+xml; + + location /assets/ { + expires 1y; + add_header Cache-Control "public, immutable"; + try_files $uri =404; + } + + location / { + try_files $uri $uri/ /index.html; + } +}