Docker with Nuxt js
Configure a development container
Create a docker-compose.yml
file and add the following content.
version: '3.3'
services: nuxt: build: context: . image: your-image-name container_name: your-container-name command: npm run dev volumes: - .:/app - /app/node_modules ports: - "3000:3000"
Create a Dockerfile
file and add the following content.
# The name is `Dockerfile` without extension
FROM node:20-alpine
WORKDIR /app
RUN apk update && apk upgradeRUN apk add git
COPY ./package*.json /app/
RUN npm install && npm cache clean --force
COPY . .
ENV PATH ./node_modules/.bin/:$PATH
Execute the container :
docker-compose up