Adicionar dockerfile
This commit is contained in:
commit
f4be9dff4b
34
dockerfile
Normal file
34
dockerfile
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Etapa 1: Build da aplicação
|
||||||
|
FROM node:20 AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copia package.json e package-lock.json (se houver)
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Instala dependências
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Copia todo o código para dentro do container
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Builda o projeto React (com Tailwind processado)
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Etapa 2: Servir a build estática usando Nginx
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# Remove a configuração default do nginx
|
||||||
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
# Copia a configuração customizada para servir a build React
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
|
# Copia os arquivos estáticos gerados pelo React build
|
||||||
|
COPY --from=builder /app/build /usr/share/nginx/html
|
||||||
|
|
||||||
|
# Expõe a porta 80
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Comando padrão para iniciar o nginx
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Loading…
x
Reference in New Issue
Block a user