Skip to content

Commit

Permalink
Merge pull request #25 from MetroStar/CSG-1085
Browse files Browse the repository at this point in the history
CSG-1085: Add Docker support to Comet Starter App
  • Loading branch information
jbouder committed Oct 3, 2023
2 parents 5c5724b + 2946d14 commit aad2fbb
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 27 deletions.
26 changes: 26 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
**/.classpath
**/.dockerignore
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/dist
**/reports
LICENSE
README.md
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Stage 1: Build the React app
FROM node:18 as build

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the entire app to the working directory
COPY . .

# Build the React app
RUN npm run build

# Stage 2: Serve the built app using a lightweight web server
FROM nginx:1.21

# Copy the built app from the previous stage
COPY --from=build /app/dist /usr/share/nginx/html

# Copy the default Nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Expose port 8080
EXPOSE 8080

# Start Nginx when the container starts
CMD ["nginx", "-g", "daemon off;"]
18 changes: 18 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server {
listen 8080;
server_name localhost;

root /usr/share/nginx/html;
index index.html;

location / {
try_files $uri /index.html;
}

location /api {
proxy_pass http://localhost:5000/api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
26 changes: 1 addition & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@
"@metrostar/comet-uswds": "1.5.0",
"@tanstack/react-query": "4.32.0",
"@tanstack/react-table": "8.9.3",
"@types/keycloak-js": "^3.4.1",
"@uswds/uswds": "3.6.0",
"axios": "1.4.0",
"axios-mock-adapter": "1.21.5",
"keycloak-js": "^22.0.1",
"oidc-client-ts": "^2.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down

0 comments on commit aad2fbb

Please sign in to comment.