Skip to content

Commit 25b2eaf

Browse files
author
Paul
committed
Refactor Docker setup: remove Dockerfile and download script, integrate release download in docker-compose.yml
1 parent e4e4816 commit 25b2eaf

File tree

4 files changed

+29
-71
lines changed

4 files changed

+29
-71
lines changed

Dockerfile

Lines changed: 0 additions & 18 deletions
This file was deleted.

docker-compose.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
version: '3.8'
22

33
services:
4-
app:
5-
build:
6-
context: .
7-
dockerfile: Dockerfile
4+
web:
5+
image: nginx:alpine
86
ports:
9-
- "80:80"
10-
environment:
11-
- GITHUB_REPO=Space-Banane/imsoprintingit
7+
- "7546:80"
128
volumes:
13-
- ./nginx.conf:/etc/nginx/nginx.conf:ro
9+
- ./nginx.conf:/etc/nginx/nginx.conf
10+
command: >
11+
sh -c "
12+
echo 'Starting nginx container and downloading latest release...' &&
13+
apk add --no-cache curl unzip jq &&
14+
curl -s https://api.github.com/repos/Space-Banane/imsoprintingit/releases/latest |
15+
jq -r '.assets[] | select(.name==\"dist.zip\") | .browser_download_url' |
16+
xargs curl -L -o /tmp/dist.zip &&
17+
unzip -o /tmp/dist.zip -d /usr/share/nginx/html/ &&
18+
rm /tmp/dist.zip &&
19+
echo 'Nginx is running and serving the latest release.' &&
20+
nginx -g 'daemon off;'
21+
"
22+
healthcheck:
23+
test: ["CMD", "curl", "-f", "http://localhost"]
24+
interval: 30s
25+
timeout: 10s
26+
retries: 3
27+
start_period: 10s
1428
restart: unless-stopped

download-latest.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

nginx.conf

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,18 @@ http {
66
include /etc/nginx/mime.types;
77
default_type application/octet-stream;
88

9-
sendfile on;
10-
keepalive_timeout 65;
9+
sendfile on;
10+
keepalive_timeout 65;
1111

1212
server {
13-
listen 80;
14-
server_name localhost;
13+
listen 80;
14+
server_name localhost;
1515

16-
root /usr/share/nginx/html;
17-
index index.html index.htm;
16+
root /usr/share/nginx/html;
17+
index index.html;
1818

19-
# Handle client-side routing
2019
location / {
2120
try_files $uri $uri/ /index.html;
2221
}
23-
24-
# Cache static assets
25-
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
26-
expires 1y;
27-
add_header Cache-Control "public, immutable";
28-
}
29-
30-
# Security headers
31-
add_header X-Frame-Options "SAMEORIGIN" always;
32-
add_header X-XSS-Protection "1; mode=block" always;
33-
add_header X-Content-Type-Options "nosniff" always;
3422
}
35-
}
23+
}

0 commit comments

Comments
 (0)