-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (20 loc) · 1.03 KB
/
Dockerfile
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
FROM node:latest AS builder
# Above, we set the base image for this first stage as a light weigh node
WORKDIR './app'
# Above we set the build environment as a folder called /app in the docker container to prevent clashes
COPY package*.json ./
# To prevent repeated npm installs anytime we make any change, we'd copy over the package.json and install things first
RUN npm install
# Install dependencies
COPY ./ ./
# Copy the rest of the project over to the /app folder in the container
RUN npm run build
# Build the production version of our app in the container
FROM nginx
# The image needs nginx to run on aws
EXPOSE 80
#Nginx runs on port 80, so elastic beanstalk uses the expose command to expose this port
COPY --from=builder /app/build /usr/share/nginx/html
# Copy the content of the builder step, move the contents of build folder into the html folder in this nginx container
# That's where our app would run from in aws
# No need to specify a command to start nginx as it gets started by default when a container with the image starts