diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d347c4f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +node_modules +dist +.git +.gitignore +.npm +*.log +.DS_Store +.env +.env.* +! \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..feceeb0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:22-alpine AS build + +WORKDIR /app + +COPY package*.json ./ +RUN npm ci + +COPY . . +RUN npm run build + +FROM nginx: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;"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..54c2962 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + landing-page: + build: + context: . + dockerfile: Dockerfile + image: gruperly-landing-page:latest + container_name: gruperly-landing-page + restart: unless-stopped diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..5217146 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,23 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + gzip on; + gzip_types text/plain text/css application/json application/javascript image/svg+xml; + + add_header X-Content-Type-Options "nosniff" always; + add_header X-Frame-Options "SAMEORIGIN" always; + + location / { + try_files $uri $uri/ /index.html; + } + + location ~* \.(?:js|css|svg|png|jpg|jpeg|gif|ico|webp|woff2?)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + try_files $uri =404; + } +} \ No newline at end of file