Skip to content

Commit

Permalink
Merge pull request #39 from victoralvesf/add-docker-build
Browse files Browse the repository at this point in the history
Add docker publish workflow
  • Loading branch information
victoralvesf authored Sep 30, 2024
2 parents 4e68c49 + b187c42 commit b4217e6
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
README.md
dist
node_modules
src_tauri
media
LICENSE.txt
.git
.DS_Store
.vscode
53 changes: 53 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish Docker Image

on: workflow_dispatch

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push_to_registry:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4

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

- name: Docker metadata (tags, labels)
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=${{ github.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: |
linux/amd64
linux/arm/v7
linux/arm64/v8
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Build stage
FROM node:20-alpine AS build

WORKDIR /app

COPY package*.json ./
RUN npm install --legacy-peer-deps
COPY . .
RUN npm run build

# Final stage
FROM nginx:alpine

COPY --chown=nginx:nginx --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf.template /etc/nginx/templates/default.conf.template

EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]
45 changes: 45 additions & 0 deletions nginx.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
server {
listen 8080;

# Enable sendfile and optimize TCP settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;

# Set default content type
default_type application/octet-stream;

# Enable GZIP compression
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/javascript application/x-javascript text/javascript application/json text/xml application/xml application/xml+rss;
gzip_comp_level 5;

# Set keep-alive timeout
keepalive_timeout 65;

# Limit request body size
client_max_body_size 10M;

# Add security headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

location / {
alias /usr/share/nginx/html/;
try_files $uri /index.html =404;
}

# Serve static files with cache and security headers
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
root /usr/share/nginx/html;
access_log off;
expires 30d;
add_header Cache-Control "public";
}
}
2 changes: 1 addition & 1 deletion src/app/components/fullscreen/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function FullscreenMode({ children }: FullscreenModeProps) {
return (
<Drawer
fixed
dismissible={false}
dismissible={true}
handleOnly={true}
disablePreventScroll={true}
>
Expand Down

0 comments on commit b4217e6

Please sign in to comment.