Skip to content

Commit 72a2eb4

Browse files
committed
feat: add Docker build infrastructure for portal-builder
- Add Dockerfile for multi-stage portal builds with xportal - Add build-portal.sh script for building with plugin manifests - Add GitHub Actions workflow for automated Docker image builds - Add JSON schema for plugin manifest validation - Add comprehensive documentation in README.md - Configure git-town for branch management - Update copyright license to Hammer Technologies LLC
1 parent 0ac649f commit 72a2eb4

File tree

9 files changed

+691
-1
lines changed

9 files changed

+691
-1
lines changed

.dockerignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Ignore common development files
2+
.git
3+
.gitignore
4+
*.md
5+
!README.md
6+
.DS_Store
7+
.vscode
8+
.idea
9+
10+
# Ignore Go artifacts
11+
*.exe
12+
*.exe~
13+
*.dll
14+
*.so
15+
*.dylib
16+
*.test
17+
*.out
18+
go.sum
19+
20+
# Ignore node_modules if any
21+
node_modules
22+
23+
# Ignore test coverage
24+
coverage.txt
25+
coverage.html
26+
27+
# Ignore local builds
28+
dist/
29+
build/
30+
bin/
31+
32+
# Schema is optional for users, keep it
33+
!schema.json

.github/workflows/build-docker.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- develop
12+
schedule:
13+
- cron: '0 2 * * 0' # Weekly Sunday 2am UTC - refresh dependencies
14+
workflow_dispatch:
15+
inputs:
16+
force-fresh:
17+
description: 'Force fresh build without cache'
18+
required: false
19+
default: 'false'
20+
21+
env:
22+
REGISTRY: ghcr.io
23+
IMAGE_NAME: ${{ github.repository }}
24+
25+
jobs:
26+
build:
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: read
30+
packages: write
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
36+
- name: Set up QEMU
37+
uses: docker/setup-qemu-action@v3
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v3
41+
42+
- name: Log in to GHCR
43+
uses: docker/login-action@v3
44+
with:
45+
registry: ${{ env.REGISTRY }}
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Extract metadata
50+
id: meta
51+
uses: docker/metadata-action@v5
52+
with:
53+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
54+
tags: |
55+
type=ref,event=branch
56+
type=ref,event=pr
57+
type=semver,pattern={{version}}
58+
type=semver,pattern={{major}}.{{minor}}
59+
type=semver,pattern={{major}}
60+
type=raw,value=latest,enable={{github.ref == 'refs/heads/develop'}}
61+
62+
- name: Build and push Docker image
63+
uses: docker/build-push-action@v5
64+
with:
65+
context: .
66+
platforms: linux/amd64,linux/arm64
67+
push: ${{ github.event_name != 'pull_request' }}
68+
tags: ${{ steps.meta.outputs.tags }}
69+
labels: ${{ steps.meta.outputs.labels }}
70+
cache-from: ${{ github.event.inputs.force-fresh == 'true' && '' || 'type=gha' }}
71+
cache-to: ${{ github.event.inputs.force-fresh == 'true' && '' || 'type=gha,mode=max' }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ go.work.sum
3030
# Editor/IDE
3131
# .idea/
3232
# .vscode/
33+
.aider*

Dockerfile

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Portal Builder Base Image
2+
# Build environment for compiling LumeWeb Portal with custom plugins via docker buildx
3+
# Use as a base image in your Dockerfile: FROM ghcr.io/lumeweb/portal-builder:latest
4+
5+
FROM golang:1.25-alpine
6+
7+
# Install build dependencies
8+
RUN apk add --no-cache \
9+
git \
10+
make \
11+
gcc \
12+
musl-dev \
13+
libwebp-dev \
14+
ca-certificates \
15+
tzdata \
16+
python3
17+
18+
# Install yq (YAML parser)
19+
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && \
20+
chmod +x /usr/local/bin/yq
21+
22+
# Install xportal
23+
RUN GOPROXY=direct go install go.lumeweb.com/xportal/cmd/xportal@latest
24+
25+
# Pre-populate Go module cache for common dependencies
26+
# This significantly speeds up builds in child images by avoiding re-downloads
27+
# Set explicit Go module cache path
28+
ENV GOMODCACHE=/go/pkg/mod
29+
30+
# Create a temporary workspace for downloading modules
31+
WORKDIR /tmp/cache-warmup
32+
33+
# Download Portal core dependencies (develop version)
34+
# This creates go.mod and populates the module cache
35+
RUN go mod init cache-warmup && \
36+
GOPROXY=direct go get go.lumeweb.com/portal@develop && \
37+
go mod download go.lumeweb.com/portal@develop && \
38+
# Clean up temporary files
39+
rm -rf /tmp/cache-warmup
40+
41+
# Return to standard working directory
42+
WORKDIR /workspace
43+
44+
# Install check-jsonschema for YAML validation using uv
45+
# Create venv and install (only needed during build, discarded in final image)
46+
RUN python3 -m venv /opt/venv && \
47+
/opt/venv/bin/pip install --upgrade pip && \
48+
/opt/venv/bin/pip install --no-cache-dir check-jsonschema && \
49+
ln -s /opt/venv/bin/check-jsonschema /usr/local/bin/check-jsonschema
50+
51+
# Copy build script and schema
52+
COPY build-portal.sh /usr/local/bin/build-portal
53+
COPY schema.json /usr/local/share/portal-builder/schema.json
54+
RUN chmod +x /usr/local/bin/build-portal
55+
56+
# Set default environment variables
57+
ENV PLUGIN_MANIFEST=portal-plugins.yaml
58+
ENV SCHEMA_PATH=/usr/local/share/portal-builder/schema.json
59+
ENV OUTPUT_DIR=/dist
60+
ENV PATH="/root/.local/bin:${PATH}"
61+
62+
# Set working directory
63+
WORKDIR /workspace
64+
65+
# No ENTRYPOINT - this is a base image for buildx
66+
# Users will RUN build-portal in their Dockerfiles

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2026 Lume Web
3+
Copyright (c) 2026 Hammer Technologies LLC
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)