Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devops/deployment #11

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:20-alpine as builder

WORKDIR /app

ARG NEXT_PUBLIC_API_URL

COPY . .

RUN yarn

RUN yarn build

FROM nginx:1.19-alpine

COPY --from=builder /app/out /usr/share/nginx/html

# SSL Config

COPY nginx.conf /etc/nginx/conf.d/default.conf

CMD ["nginx", "-g", "daemon off;"]
13 changes: 13 additions & 0 deletions docker-compose-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'
services:
nginx:
build:
context: .
dockerfile: Dockerfile
args:
- NEXT_PUBLIC_API_URL="https://dracula.betterw8.com:10443"
volumes:
- /ssl:/ssl
ports:
- "443:443"
restart: always
6 changes: 6 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ console.log(`\

/** @type {import('next').NextConfig} */
const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
output: 'export',
}

Expand Down
31 changes: 31 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
server {
listen 80;
server_name dracula.betterw8.com;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;
server_name dracula.betterw8.com;

ssl_certificate /ssl/ssl.crt;
ssl_certificate_key /ssl/ssl.key;

# Strong SSL Settings
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
ssl_prefer_server_ciphers on;

# HSTS (optional)
add_header Strict-Transport-Security "max-age=31536000" always;

# Your website's root directory
root /usr/share/nginx/html;
index index.html index.htm;

# Additional configurations for file serving, logging, etc.

location / {
try_files $uri $uri/ /index.html;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
"tailwindcss": "^3",
"typescript": "^5"
}
}
}