Skip to content

Commit ef4c7f6

Browse files
docker init
1 parent d9b6b7c commit ef4c7f6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// .dockerignore
2+
node_modules
3+
build

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ==== CONFIGURE =====
2+
# Use a Node 16 base image
3+
FROM node:16-alpine
4+
# Set the working directory to /app inside the container
5+
WORKDIR /app
6+
# Copy app files
7+
COPY . .
8+
# ==== BUILD =====
9+
# Install dependencies (npm ci makes sure the exact versions in the lockfile gets installed)
10+
RUN npm ci
11+
# Build the app
12+
RUN npm run build
13+
# ==== RUN =======
14+
# Set the env to "production"
15+
ENV NODE_ENV production
16+
# Expose the port on which the app will be running (3000 is the default that `serve` uses)
17+
EXPOSE 3000
18+
# Start the app
19+
CMD [ "npx", "serve", "build" ]

0 commit comments

Comments
 (0)