Skip to content

Commit

Permalink
Add docker builds
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Reidel <[email protected]>
  • Loading branch information
Gelbpunkt committed May 19, 2024
1 parent d346b9d commit 11cbf4f
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 46 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and Push Docker Image

on:
push:
branches:
- main # Adjust this to your main branch

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args:
- VITE_API_HOSTNAME: https://lineage-downloads.mainlining.org/
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
17 changes: 0 additions & 17 deletions .github/workflows/check.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/deploy.yml

This file was deleted.

15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM docker.io/library/alpine:edge AS builder
ARG VITE_API_HOSTNAME

RUN apk add --no-cache nodejs-current npm

WORKDIR /src
COPY . .

RUN echo "VITE_API_HOSTNAME=${VITE_API_HOSTNAME}" > .env.local && \
npm run build

FROM docker.io/library/nginx:alpine

COPY --from=builder /src/dist /dist
COPY nginx.conf /etc/nginx/nginx.conf
46 changes: 46 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
user nginx;
worker_processes auto;

error_log /dev/stderr; # Redirect error logs to stderr
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /dev/stdout main; # Redirect access logs to stdout

sendfile on;

keepalive_timeout 65;

server {
listen 80 default;
real_ip_header X-Real-IP;
real_ip_recursive on;
set_real_ip_from 0.0.0.0/0;

root /dist/;
index index.html index.htm;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 15 8k;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location ~* \.(?:css|js|png)$ {
expires 1d;
add_header Cache-Control "public";
}
}
}

0 comments on commit 11cbf4f

Please sign in to comment.