File tree Expand file tree Collapse file tree 5 files changed +102
-46
lines changed
Expand file tree Collapse file tree 5 files changed +102
-46
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Push Docker Image
2+
3+ on :
4+ push :
5+ branches :
6+ - main # Adjust this to your main branch
7+
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v4
15+
16+ - name : Set up Docker Buildx
17+ uses : docker/setup-buildx-action@v3
18+
19+ - name : Login to GitHub Container Registry
20+ uses : docker/login-action@v3
21+ with :
22+ registry : ghcr.io
23+ username : ${{ github.actor }}
24+ password : ${{ secrets.GITHUB_TOKEN }}
25+
26+ - name : Build and push Docker image
27+ uses : docker/build-push-action@v5
28+ with :
29+ context : .
30+ push : true
31+ build-args : |
32+ VITE_API_HOSTNAME=/
33+ tags : |
34+ ghcr.io/${{ github.repository }}:latest
35+ ghcr.io/${{ github.repository }}:${{ github.sha }}
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ FROM docker.io/library/alpine:edge AS builder
2+ ARG VITE_API_HOSTNAME
3+
4+ RUN apk add --no-cache nodejs-current npm
5+
6+ WORKDIR /src
7+ COPY . .
8+
9+ RUN echo "VITE_API_HOSTNAME=${VITE_API_HOSTNAME}" > .env.local && \
10+ npm i && \
11+ npm run build
12+
13+ FROM docker.io/library/nginx:alpine
14+
15+ COPY --from=builder /src/dist /dist
16+ COPY nginx.conf /etc/nginx/nginx.conf
Original file line number Diff line number Diff line change 1+ user nginx;
2+ worker_processes auto;
3+
4+ error_log /dev/stderr; # Redirect error logs to stderr
5+ pid /var/run/nginx.pid ;
6+
7+ events {
8+ worker_connections 1024 ;
9+ }
10+
11+
12+ http {
13+ include /etc/nginx/mime.types ;
14+ default_type application/octet-stream ;
15+
16+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
17+ '$status $body_bytes_sent "$http_referer" '
18+ '"$http_user_agent" "$http_x_forwarded_for"' ;
19+
20+ access_log /dev/stdout main; # Redirect access logs to stdout
21+
22+ sendfile on;
23+
24+ keepalive_timeout 65 ;
25+
26+ server {
27+ listen 80 default;
28+ real_ip_header X-Real-IP;
29+ real_ip_recursive on;
30+ set_real_ip_from 0.0.0.0 /0;
31+
32+ root /dist/;
33+ index index .html index .htm;
34+ gzip on;
35+ gzip_disable "msie6" ;
36+ gzip_vary on;
37+ gzip_proxied any;
38+ gzip_comp_level 6;
39+ gzip_buffers 15 8k ;
40+ gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
41+
42+ location / {
43+ try_files $uri $uri / /index .html;
44+ }
45+
46+ location ~ * \.(?:css|js|png)$ {
47+ expires 1d ;
48+ add_header Cache-Control "public" ;
49+ }
50+ }
51+ }
You can’t perform that action at this time.
0 commit comments