Skip to content

Commit

Permalink
adds Dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
joaovictornsv committed Nov 9, 2024
1 parent 4ea776f commit aa87161
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.git
.svn


# Build files
node_modules/
npm-debug.log
Expand Down Expand Up @@ -44,4 +43,4 @@ dist
*.swp
*.tgz
*.zip
*.gz
*.gz
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Etapa 1: Construção do projeto
FROM node:18 AS build

# Diretório de trabalho no contêiner
WORKDIR /app

# Copia o package.json e o package-lock.json (ou yarn.lock) para instalar as dependências
COPY package*.json ./

# Instala as dependências
RUN npm install

# Copia todos os arquivos do projeto para o contêiner
COPY . .

# Executa o build do projeto Vite
RUN npm run build

# Etapa 2: Configuração do ambiente de produção
FROM node:18-slim

# Diretório de trabalho no contêiner
WORKDIR /app

# Instala o servidor estático para servir o conteúdo construído
RUN npm install -g serve

# Copia apenas os arquivos necessários para o ambiente de produção
COPY --from=build /app/dist /app/dist

# Expondo a porta para o servidor estático
EXPOSE 3000

# Comando para iniciar o servidor
CMD ["serve", "-s", "dist", "-l", "3000"]
1 change: 0 additions & 1 deletion Dockeryzer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ USER node:node
# Customization suggestion: If your application's working directory is different, you can modify it by changing the value of the WORKDIR variable.
WORKDIR /workspace/app


# Copy all files from the current host directory to the application's working directory in the container.
COPY --chown=node:node . /workspace/app

Expand Down

0 comments on commit aa87161

Please sign in to comment.