Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/container-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Container Build"

on:
push:
branches:
- "master"
- "develop"

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
container:
image: moby/buildkit:latest
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Build container
run: |
REPO="$(echo "$GITHUB_REPOSITORY" | tr "[:upper:]" "[:lower:]")"
PARAMS="--output type=image,\"name=ghcr.io/${REPO}:${{ github.ref_name }}\",push=true"
# registry credentials
export DOCKER_CONFIG="$(pwd)/container"
echo "{\"auths\":{\"ghcr.io\":{\"auth\":\"$(echo -n ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | base64 -w 0)\"}}}" > $DOCKER_CONFIG/config.json
# build
buildctl-daemonless.sh build \
--progress plain \
--frontend=dockerfile.v0 \
--local context=. \
--local dockerfile=container \
$PARAMS
1 change: 1 addition & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default defineConfig({
title: "MagicMirror² Docs",
description: "The open source modular smart mirror platform.",
lang: "en",
ignoreDeadLinks: "localhostLinks",
head: [
[
"script",
Expand Down
25 changes: 25 additions & 0 deletions container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:alpine AS builder

WORKDIR /workspace

COPY . .

RUN <<EOF
set -e
apk add git
git log -1
npm install
node --run docs:build
EOF

FROM nginxinc/nginx-unprivileged:alpine-slim
LABEL maintainer="MagicMirrorOrg"

COPY container/default.conf /etc/nginx/conf.d/
COPY container/nginx.conf /etc/nginx/

COPY --from=builder /workspace/.vitepress/dist /usr/share/nginx/website/

EXPOSE 8080

HEALTHCHECK --timeout=10s --start-period=60s CMD wget -qO /dev/null http://0.0.0.0:8080
26 changes: 26 additions & 0 deletions container/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
server {
listen 8080;
server_name localhost;

access_log /var/log/nginx/access.log main;

location / {
root /usr/share/nginx/website;
index index.html index.htm;
# Do not cache HTML to allow quick refresh of UI changes
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}

# Cache-bust static assets aggressively; paths are stable under website/
location ~* \.(?:css|js|svg|woff2?|ttf|eot|ico|png|jpg|jpeg|gif|webp)$ {
root /usr/share/nginx/website;
access_log off;
expires 30d;
add_header Cache-Control "public, max-age=2592000, immutable";
}

error_page 404 /404.html;

}
38 changes: 38 additions & 0 deletions container/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
worker_processes auto;

error_log /var/log/nginx/error.log warn;
pid /tmp/nginx.pid;

events {
worker_connections 1024;
}

http {
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;

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

gzip on;
gzip_comp_level 6;
gzip_min_length 1024;
gzip_proxied any;
gzip_vary on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;

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

access_log /var/log/nginx/access.log main;

sendfile on;

keepalive_timeout 65;

include /etc/nginx/conf.d/*.conf;
}
2 changes: 1 addition & 1 deletion cspell.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@
"yearmatchgroup",
"yourprovider"
],
"ignorePaths": ["node_modules/**"],
"ignorePaths": ["container/**", "node_modules/**"],
"dictionaries": ["node"]
}