Merge pull request 'Reduce docker image size' (#62) from v0.2/infrastructure-fixes into develop

Reviewed-on: #62
This commit is contained in:
lamacchinadesiderante 2024-05-11 11:15:11 +00:00
commit 5a3577ec2e
3 changed files with 16 additions and 13 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
node_modules
.git
.gitignore
.next
package-lock.json

View File

@ -1,23 +1,21 @@
# Usa la versione alpine più recente di Node.js compatibile con Next.js 14 come base # PHASE 1: copy and build
FROM node:alpine
FROM node:alpine AS build
# Imposta la directory di lavoro nel container
WORKDIR /app WORKDIR /app
# Copia i file esistenti nella root del progetto nel container
COPY . . COPY . .
# Rimuovi la cartella node_modules (se presente) RUN rm -rf node_modules && npm install && npm run build
RUN rm -rf node_modules
# Installa le dipendenze # PHASE 2: prepare for exec
RUN npm install
# Esegui la build del progetto FROM node:alpine AS exec
RUN npm run build
WORKDIR /app
COPY --from=build /app/. .
# Esponi la porta 3000
EXPOSE 3000 EXPOSE 3000
# Avvia il server in modalità di produzione
CMD ["npm", "run", "start"] CMD ["npm", "run", "start"]

View File

@ -1,6 +1,6 @@
{ {
"name": "proxyraye-next", "name": "proxyraye-next",
"version": "0.1.0", "version": "0.2.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",