forked from cloudxlab/react-project-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (20 loc) · 651 Bytes
/
Dockerfile
File metadata and controls
28 lines (20 loc) · 651 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
#### Step 1
# Use an existing docker image as base
FROM node:alpine as builder
# Specify WORKDIR
WORKDIR '/app'
# Copy the package.json from your work directory to the container's work directory
# Until we copy the package.json file to container work directory, npm install will not work
COPY package.json ./
# Install dependencies
RUN npm install
# Copy the source code from your work directory to the container's work directory
COPY . .
# Startup Command
RUN npm run build
#### Step 2
# Copy the build directory to Nginx directory
# Fetch nginx image from docker hub
FROM nginx
EXPOSE 80
COPY --from=builder /app/build /usr/share/nginx/html