-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from bcgov/test
PROD deployment
- Loading branch information
Showing
45 changed files
with
830 additions
and
333 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,2 @@ | ||
**/node_modules | ||
**/dist |
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 |
---|---|---|
@@ -1,38 +1,13 @@ | ||
# Stage 1: Build the application | ||
FROM node:lts-alpine AS builder | ||
|
||
# Set the working directory inside the container | ||
FROM node:latest as build-stage | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm ci | ||
|
||
# Copy the rest of the application code to the working directory | ||
COPY . . | ||
|
||
# Build the application | ||
RUN npm install | ||
COPY ./ . | ||
RUN npm run build | ||
|
||
# Stage 2: Serve the application | ||
FROM node:lts-alpine | ||
|
||
# Install http-server globally to serve static files | ||
RUN npm install -g http-server | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the built files from the previous stage | ||
COPY --from=builder /app/dist ./dist | ||
|
||
# Copy index.html to 404 to fix client side routing | ||
COPY --from=builder /app/dist/index.html ./dist/404.html | ||
|
||
# Expose port 5173 to the outside world | ||
EXPOSE 5173 | ||
|
||
# Command to run http-server to serve the built files | ||
CMD ["http-server", "dist", "-p", "5173", "--history-api-fallback"] | ||
FROM nginxinc/nginx-unprivileged:stable-alpine as production-stage | ||
ENV NODE_ENV production | ||
COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=build-stage /app/dist /usr/share/nginx/html | ||
EXPOSE 5173:5173 | ||
CMD ["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
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,35 @@ | ||
server { | ||
# Enable HTTP Strict Transport Security (HSTS) to force clients to always | ||
# connect via HTTPS (do not use if only testing) | ||
add_header Strict-Transport-Security "max-age=31536000;"; | ||
|
||
# Enable cross-site filter (XSS) and tell browser to block detected attacks | ||
add_header X-XSS-Protection "1; mode=block"; | ||
|
||
# Prevent some browsers from MIME-sniffing a response away from the declared Content-Type | ||
add_header X-Content-Type-Options "nosniff"; | ||
|
||
# Disallow the site to be rendered within a frame (clickjacking protection) | ||
add_header X-Frame-Options "DENY"; | ||
|
||
# Turn off all caddy caching | ||
add_header Cache-Control "no-cache,no-store,must-revalidate"; | ||
add_header Pragma "no-cache"; | ||
listen 5173; | ||
server_name localhost; | ||
location / { | ||
root /usr/share/nginx/html; | ||
include /etc/nginx/mime.types; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
location ~* /favicon\.ico$ { | ||
root /usr/share/nginx/html; | ||
try_files /favicon.ico =404; | ||
} | ||
error_page 500 502 503 504 /50x.html; | ||
location @index { | ||
expires 0; | ||
try_files /index.html =404; | ||
} | ||
} |
File renamed without changes
File renamed without changes
File renamed without changes
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.