Skip to content

Commit 4790c2c

Browse files
committed
feat: add Docker setup with Nginx
1 parent 7a733ab commit 4790c2c

File tree

4 files changed

+57
-1
lines changed

4 files changed

+57
-1
lines changed

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:22-slim
2+
WORKDIR /app
3+
COPY package*.json ./
4+
RUN npm install
5+
COPY . .
6+
RUN npm run build
7+
8+
COPY nginx.conf /etc/nginx/conf.d/default.conf
9+
RUN apt-get update && \
10+
apt-get install -y nginx && \
11+
apt-get clean && \
12+
rm -rf /var/lib/apt/lists/*
13+
14+
RUN find . -mindepth 1 \
15+
! -name 'dist' \
16+
! -name 'entrypoint.sh' \
17+
! -path './dist/*' \
18+
-ignore_readdir_race \
19+
-exec rm -rf {} + || true
20+
21+
22+
RUN chmod +x ./entrypoint.sh
23+
24+
EXPOSE 8080
25+
26+
ENTRYPOINT ["/app/entrypoint.sh"]

entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
echo STARTING NGINX WEB SERVER
3+
nginx -g "daemon off;"

nginx.conf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
server {
2+
listen 8080;
3+
4+
location / {
5+
root /app/dist/rss-angular/browser;
6+
index index.html;
7+
try_files $uri $uri/ /index.html;
8+
}
9+
10+
error_page 500 502 503 504 /50x.html;
11+
12+
location = 50x.html {
13+
root /app/dist/rss-angular/browser;
14+
}
15+
16+
location /api {
17+
proxy_http_version 1.1;
18+
proxy_set_header Upgrade $http_upgrade;
19+
proxy_set_header Connection "upgrade";
20+
proxy_set_header X-Forwarded-Proto $scheme;
21+
proxy_set_header X-Forwarded-For $remote_addr;
22+
proxy_set_header Host $host;
23+
proxy_cache_bypass $http_upgrade;
24+
rewrite ^/api(/.*)$ $1 break;
25+
proxy_pass http://rss-nest:3600;
26+
}
27+
}

src/environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Environment } from './environment.types'
22

33
export const environment: Environment = {
4-
api: 'http://localhost:3600',
4+
api: 'http://rss-nest:3600/api',
55
}

0 commit comments

Comments
 (0)