Skip to content

Commit

Permalink
docker ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
susyexists committed Jun 26, 2024
1 parent d4d6489 commit 0ba457c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Dockerfile.client
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ RUN npm run build
FROM nginx:stable-alpine
COPY --from=build-step /app/dist /usr/share/nginx/html
COPY deployment/nginx.default.conf /etc/nginx/conf.d/default.conf
RUN openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/C=US/ST=MA/L=Boston/O=TransverseInstitute/OU=TRV/CN=transverse.institute"
RUN cp ./key.pem:/root/ssl/key.pem
RUN cp ./cert.pem:/root/ssl/cert.pem

# Start Nginx when the container runs
CMD ["nginx", "-g", "daemon off;"]
14 changes: 10 additions & 4 deletions deployment/nginx.default.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# nginx configuration for Docker

server {
listen 80;
server_name localhost;

listen 443 ssl;
listen [::]:443 ssl;
server_name localhost;
ssl_certificate /root/ssl/cert.pem;
ssl_certificate_key /root/ssl/key.pem;
root /usr/share/nginx/html;
index index.html;
error_page 500 502 503 504 /50x.html;
Expand All @@ -17,7 +19,11 @@ server {
expires 1y;
add_header Cache-Control "public";
}
location /app {
location /app {
proxy_pass http://app:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ services:
context: .
dockerfile: Dockerfile.server
image: phonon-visualizer-server
ports:
- "5000:5000"
client:
build:
context: .
dockerfile: Dockerfile.client
image: phonon-visualizer-client
ports:
- "8080:80"
- "4433:443"
depends_on:
- app
2 changes: 1 addition & 1 deletion src/components/phonons/PhononsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { VisualizerProps } from "./interfaces";
import SelectPanel from "./select/SelectPanel";
import VisualizerPanel from "./visualize/VisualizerPanel";

const API_ROOT = "http://localhost:5000";
const API_ROOT = "https://localhost:5000";

const PhononsPanel = ({
aboutLinkHandler,
Expand Down
1 change: 0 additions & 1 deletion test

This file was deleted.

0 comments on commit 0ba457c

Please sign in to comment.