-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM node:18 AS builder | ||
|
||
# set working directory | ||
WORKDIR /app | ||
|
||
|
||
# install app dependencies | ||
|
||
COPY package* yarn.lock .pnp* ./ | ||
COPY .yarnrc.yml ./ | ||
COPY .yarn ./.yarn | ||
|
||
# Installs all node packages | ||
RUN yarn install --immutable | ||
|
||
# Copies everything over to Docker environment | ||
COPY . . | ||
RUN yarn build | ||
|
||
#Stage 2 | ||
####################################### | ||
#pull the official nginx:1.19.0 base image | ||
FROM nginx | ||
#copies React to the container directory | ||
# Set working directory to nginx resources directory | ||
# WORKDIR /usr/share/nginx/html | ||
COPY config/nginx/default.conf /etc/nginx/conf.d/default.conf | ||
# Remove default nginx static resources | ||
RUN rm -rf ./usr/share/nginx/html/* | ||
# Copies static resources from builder stage | ||
COPY --from=builder /app/build /usr/share/nginx/html/ | ||
# Containers run nginx with global directives and daemon off | ||
EXPOSE 3000 | ||
ENTRYPOINT ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
server { | ||
listen 3000; | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri /index.html; | ||
} | ||
|
||
error_log /var/log/nginx/api_error.log; | ||
access_log /var/log/nginx/api_access.log; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters