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:
workflow_dispatch: # needed for manually running this workflow
schedule:
- cron: "30 5 * * *" # sadly there is no TZ support here

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest
steps:
# checkout code:
- uses: actions/checkout@v3
# create json file with credentials for github container registry:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# ugly workaround for converting content of $GITHUB_REPOSITORY (= `MagicMirrorOrg/MagicMirror-3rd-Party-Modules`)
# to lowercase which is needed for using as image name
- name: downcase GITHUB_REPOSITORY
run: |
echo "REPO=${GITHUB_REPOSITORY@L}" >> "${GITHUB_ENV}"
# build container image with kaniko:
- uses: int128/kaniko-action@v1
with:
file: container/Dockerfile
push: true
tags: ghcr.io/${{ env.REPO }}:${{ github.ref_name }}
labels: GITREF=${{ github.sha }}
build-args: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM nikolaik/python-nodejs:latest as builder

WORKDIR /workspace

COPY . .

ARG GITHUB_TOKEN
RUN set -e; \
git config --global --add safe.directory /workspace; \
git log -1; \
export GITHUB_TOKEN="${GITHUB_TOKEN}"; \
npm clean-install; \
npm run all;

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/docs /usr/share/nginx/docs/

EXPOSE 8080
14 changes: 14 additions & 0 deletions container/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
server {
listen 8080;
server_name localhost;

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

location / {
root /usr/share/nginx/docs;
index index.html index.htm;
}

error_page 404 /404.html;

}
31 changes: 31 additions & 0 deletions container/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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;

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;
}
3 changes: 2 additions & 1 deletion cspell.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"modules/",
"modules_temp/",
"docs/**",
"eslint-config-DEBUG.json"
"eslint-config-DEBUG.json",
"container/"
],
"dictionaries": ["node"]
}