-
Notifications
You must be signed in to change notification settings - Fork 3
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
langerae
committed
Dec 4, 2023
1 parent
d346c31
commit 2007bc4
Showing
9 changed files
with
333 additions
and
12 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,25 @@ | ||
# Multi-stage | ||
# 1) Node image for building frontend assets | ||
# 2) nginx stage to serve frontend assets | ||
|
||
# Name the node stage "builder" | ||
FROM node:16 AS builder | ||
# Set working directory | ||
WORKDIR /app | ||
# Copy all files from current directory to working dir in image | ||
COPY . . | ||
# install node modules and build assets | ||
RUN npm install && npm run build | ||
|
||
# nginx state for serving content | ||
FROM nginx:alpine | ||
# Set working directory to nginx asset directory | ||
WORKDIR /usr/share/nginx/html | ||
# Remove default nginx static assets | ||
RUN rm -rf ./* | ||
# Copy static assets from builder stage | ||
COPY --from=builder /app/dist . | ||
# Add a custom nginx configuration that handles URL rewrites | ||
COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
# Containers run nginx with global directives and daemon off | ||
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,10 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.