-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (22 loc) · 804 Bytes
/
Dockerfile
File metadata and controls
30 lines (22 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Use the official Node.js base image
FROM node:18-alpine
# Set the working directory in the container
WORKDIR /app
# Copy the package.json and package-lock.json files to the container
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the application code to the container
COPY . .
# Build the React application
RUN npm run build
# Start the application
CMD ["node", "./dist/server.js"]
# Create image: docker build -t ssr-image .
# Run container: docker run -d -p 8000:8000 --rm --name ssr-container ssr-image
# Stop container: docker stop ssr-container
# Enter container: docker exec -it ssr-container sh
# Exit container: exit
# Show containers: docker ps
# Show images: docker images
# Remove image: docker rmi ssr-image