Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sakthi-aot committed Mar 13, 2024
1 parent fc74388 commit b680b59
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 44 deletions.
23 changes: 10 additions & 13 deletions app/caseflow_web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
# Base image for building the application
FROM node:14.17.0-alpine as build-stage

# Set the working directory inside the container
WORKDIR /case-flow-web/app

# Copy only the package.json and package-lock.json files to leverage Docker caching
COPY package-lock.json package.json /case-flow-web/app/

# Install dependencies
RUN npm install --unsafe-perm --dev

# Copy the entire application code
COPY . /case-flow-web/app/
COPY ./package*.json ./
RUN npm ci
COPY . ./

# Build the application
RUN npm run build

# Intermediate stage for serving the built application
FROM nginx:latest as production-stage
FROM artifacts.developer.gov.bc.ca/redhat-access-docker-remote/ubi8/nginx-122 AS deployer

USER default

# Set the working directory inside the container
WORKDIR /case-flow-web/app

# Copy the built files from the previous stage to Nginx's HTML directory
COPY --from=build-stage /case-flow-web/app/build /usr/share/nginx/html

# Copy Nginx configuration file from the host
COPY ./nginx_conf/nginx.conf /etc/nginx/nginx.conf
COPY /case-flow-web/app/nginx_conf/nginx.conf /etc/nginx/nginx.conf

# Command to start Nginx when the container starts
CMD ["nginx", "-g", "daemon off;"]
63 changes: 32 additions & 31 deletions app/caseflow_web/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,58 @@ error_log /var/log/nginx/error.log;

pid /tmp/nginx.pid;


events {
worker_connections 4096;
worker_connections 4096;
}

http {
include /etc/nginx/mime.types;
include /etc/nginx/conf.d/default.conf;
include /etc/nginx/mime.types;
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
default_type application/octet-stream;
server_tokens off;
underscores_in_headers on;
default_type application/octet-stream;
server_tokens off;
underscores_in_headers on;

# Use a w3c standard log format
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# Use a w3c standard log format
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
access_log /var/log/nginx/access.log main;


server {

# add in most common security headers
add_header Content-Security-Policy "default-src * data: blob: filesystem: 'unsafe-inline' 'unsafe-eval'";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection 1;
add_header X-Frame-Options SAMEORIGIN;

server {

# add in most common security headers
add_header Content-Security-Policy "default-src * data: blob: filesystem: 'unsafe-inline' 'unsafe-eval'; frame-ancestors 'self' https://*.apps.silver.devops.gov.bc.ca";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection 1;
add_header X-Frame-Options SAMEORIGIN;

listen 8080;
server_name _;
listen 8080;
server_name _;

index index.html;
error_log /dev/stdout info;
access_log /dev/stdout;
index index.html;
error_log /dev/stdout info;
access_log /dev/stdout;

# frontend
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;
error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}
}
location = /50x.html {
root /usr/share/nginx/html;
}
}
}

0 comments on commit b680b59

Please sign in to comment.