change in dockerfile
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
node_modules
|
|
||||||
.git
|
|
||||||
.nuxt
|
|
||||||
.idea
|
|
||||||
26
dockerfile
26
dockerfile
@@ -1,27 +1,21 @@
|
|||||||
FROM node:22-alpine AS build
|
# This dockerfile is to turn .output into a docker image
|
||||||
WORKDIR /app
|
# You still need to install the project on your machine and build it.
|
||||||
|
# Only then you run this docker file
|
||||||
|
|
||||||
#RUN corepack enable
|
# 1. pnpm i (this project uses pnpm by default, to use npm, delete 'pnpm-lock.yaml')
|
||||||
|
# 2. pnpm (or npm) run build . Sit back while it compiles
|
||||||
|
# 3. sudo docker build . -t myapp:latest (replace 'myapp' to whatever tag you wanna give your image)
|
||||||
|
|
||||||
# Copy package.json
|
# You should have the image now !
|
||||||
COPY package.json .
|
# Now you just need to create the container
|
||||||
|
|
||||||
# Install dependencies
|
# Here is an example command for creating a container
|
||||||
RUN npm i --prod
|
|
||||||
|
|
||||||
# Copy the entire project
|
# sudo docker run -d --name myappcontainer --network host -e PORT=3001 myapp:latest
|
||||||
COPY . ./
|
|
||||||
|
|
||||||
# Build the project
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Build Stage 2
|
|
||||||
|
|
||||||
FROM node:22-alpine
|
FROM node:22-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Only `.output` folder is needed from the build stage
|
|
||||||
COPY --from=build /app/.output/ ./
|
|
||||||
|
|
||||||
# Change the port and host
|
# Change the port and host
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
|
|||||||
Reference in New Issue
Block a user