Adiciona docker e nginx

This commit is contained in:
LeoMortari
2025-11-03 00:51:14 -03:00
parent e95d33f172
commit fa2b9df45b
4 changed files with 62 additions and 0 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
node_modules
dist
.git
.gitignore
Dockerfile
docker-compose.yml

14
Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev=false
COPY . .
ARG BASE=/
ENV VITE_BASE_PATH=$BASE
RUN npm run build
FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80

22
docker-compose.yml Normal file
View File

@@ -0,0 +1,22 @@
services:
web:
build:
context: .
dockerfile: Dockerfile
args:
BASE: ${BASE:-/}
image: ${IMAGE_NAME:-vite-nginx:latest}
container_name: clipperia
restart: unless-stopped
networks:
- dokploy-network
labels:
- traefik.enable=true
- traefik.http.routers.vite.rule=Host("clipperia.com.br")
- traefik.http.routers.vite.entrypoints=websecure
- traefik.http.routers.vite.tls.certresolver=letsencrypt
- traefik.http.services.vite.loadbalancer.server.port=80
networks:
dokploy-network:
external: true

20
nginx.conf Normal file
View File

@@ -0,0 +1,20 @@
server {
listen 80;
server_name _;
absolute_redirect off;
port_in_redirect off;
root /usr/share/nginx/html;
index index.html;
location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|svg|ico|woff2?)$ {
expires 7d;
add_header Cache-Control "public, max-age=604800, immutable";
try_files $uri =404;
}
location / {
try_files $uri $uri/ /index.html;
}
}