Skip to content

Commit 2c5ed37

Browse files
committed
feat: source-build Dockerfile, GHCR CI workflow, OpenSensor branding
- docker/Dockerfile.source: multi-stage build from source (no PyPI dependency) Stage 1 installs Node 18 + babel, compiles translations and static assets, builds the Python wheel with hatchling. Stage 2 installs the wheel + redis-server + supervisor for a self-contained image. - .github/workflows/docker-image.yml: standalone Docker build & push workflow Triggers on push to main and version tags (v*), also supports manual dispatch. Publishes ghcr.io/opensensor/fief:latest and semver tags to GHCR. Uses GHA cache for fast rebuilds. - styles/globals.scss: replace Fief rose/pink palette with OpenSensor teal palette Primary colours now use Tailwind teal-500 (#14b8a6) through teal-900 (#134e4a). - fief/templates/auth/layout.html: show OpenSensor logo as fallback header logo When no tenant logo_url is set the OpenSensor CDN logo is displayed. - fief/templates/macros/branding.html: replace Fief attribution with OpenSensor
1 parent a77e7fb commit 2c5ed37

5 files changed

Lines changed: 156 additions & 17 deletions

File tree

‎.github/workflows/docker-image.yml‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build & Publish Docker Image (Source)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
workflow_dispatch:
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: opensensor/fief
14+
15+
jobs:
16+
docker-build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up QEMU (multi-arch support)
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Log in to GitHub Container Registry
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract Docker metadata
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
tags: |
45+
type=ref,event=branch
46+
type=semver,pattern={{version}}
47+
type=semver,pattern={{major}}.{{minor}}
48+
type=raw,value=latest,enable={{is_default_branch}}
49+
50+
- name: Build and push Docker image (from source)
51+
uses: docker/build-push-action@v5
52+
with:
53+
context: .
54+
file: docker/Dockerfile.source
55+
platforms: linux/amd64,linux/arm64
56+
push: true
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max

‎docker/Dockerfile.source‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# =============================================================================
2+
# Stage 1: Build – compile translations, build static assets, build wheel
3+
# =============================================================================
4+
FROM python:3.12-slim AS builder
5+
6+
WORKDIR /build
7+
8+
# Install Node.js 18, build tools, and libpq headers for psycopg2
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
build-essential \
11+
libpq-dev \
12+
curl \
13+
ca-certificates \
14+
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
15+
&& apt-get install -y --no-install-recommends nodejs \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# Install Python build tools
19+
RUN pip install --no-cache-dir --upgrade pip babel hatchling hatch-regex-commit build
20+
21+
# Copy the full source tree
22+
COPY . .
23+
24+
# Build JavaScript/CSS static assets
25+
RUN npm ci && npm run build
26+
27+
# Compile gettext .po → .mo translation files
28+
RUN pybabel compile --domain=messages --directory=fief/locale
29+
30+
# Build the Python wheel
31+
RUN python -m build --wheel --outdir /build/dist
32+
33+
# =============================================================================
34+
# Stage 2: Runtime image
35+
# =============================================================================
36+
FROM python:3.12-slim
37+
38+
WORKDIR /app
39+
40+
ENV PYTHONUNBUFFERED=1
41+
42+
# Install runtime system dependencies:
43+
# - libpq-dev / libpq5 for psycopg2
44+
# - redis-server (bundled, no separate Redis pod needed)
45+
# - supervisor to manage multiple processes
46+
RUN apt-get update && apt-get install -y --no-install-recommends \
47+
build-essential \
48+
libpq-dev \
49+
redis-server \
50+
supervisor \
51+
&& rm -rf /var/lib/apt/lists/*
52+
53+
# Install the wheel built in stage 1
54+
COPY --from=builder /build/dist/*.whl /tmp/
55+
RUN pip install --no-cache-dir --upgrade pip \
56+
&& pip install --no-cache-dir /tmp/*.whl \
57+
&& rm /tmp/*.whl
58+
59+
# Trim build-only system packages
60+
RUN apt-get purge -y --auto-remove build-essential && rm -rf /var/lib/apt/lists/*
61+
62+
# Create persistent data directory (used when DATABASE_TYPE=SQLITE)
63+
RUN mkdir -p /data/db
64+
65+
COPY docker/supervisord.conf /etc/supervisord.conf
66+
67+
# Runtime environment defaults (override via k8s Secrets / ConfigMaps)
68+
ENV DATABASE_LOCATION=/data/db
69+
ENV SECRETS_DIR=/run/secrets
70+
ENV PORT=8000
71+
72+
EXPOSE 8000
73+
74+
CMD ["supervisord", "-c", "/etc/supervisord.conf"]

‎fief/templates/auth/layout.html‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
{% if tenant.logo_url %}
1313
<img src="{{ tenant.logo_url }}" alt="{{ tenant.name }}" class="max-h-full max-w-[100px]" />
1414
{% else %}
15-
<span class="text-3xl text-accent font-bold">{{ tenant.name }}</span>
15+
<a href="https://opensensor.io" rel="noreferrer noopener" target="_blank">
16+
<img src="https://growmax.nyc3.cdn.digitaloceanspaces.com/OpenSensorFallLogo.png"
17+
alt="OpenSensor"
18+
class="max-h-10 max-w-[160px]" />
19+
</a>
1620
{% endif %}
1721
</div>
1822
</div>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{% macro branding() %}
2-
<div class="text-xs flex justify-center items-center">
3-
<span class="mr-1 mt-1">{% trans %}Powered and secured by{% endtrans %}</span>
4-
<a href="https://www.fief.dev" rel="noreferrer noopener" target="_blank">
5-
<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 133 63" xmlns="http://www.w3.org/2000/svg" style="height: 1rem;"><g fill="currentColor" fill-rule="nonzero"><path d="m.047 0v-.727h.511v.159h-.314v.125h.283v.159h-.283v.284z" transform="matrix(71.99976445 0 0 72 -3.37627465 61.8422)"/><path d="m.05-.545h.196v.545h-.196z" transform="matrix(71.99976445 0 0 72 38.6581753 61.8422)"/><path d="m.311.01c-.058 0-.108-.011-.15-.034-.042-.022-.075-.054-.097-.096-.023-.042-.034-.093-.034-.151 0-.057.011-.106.034-.148s.055-.075.096-.098c.042-.024.09-.036.147-.036.041 0 .078.007.112.02.033.012.062.031.085.055.024.024.042.054.055.088.013.035.019.074.019.117v.046h-.487v-.108h.307c-.001-.016-.004-.03-.012-.042s-.018-.021-.031-.028c-.013-.006-.028-.01-.044-.01s-.03.004-.044.01c-.013.007-.023.016-.031.028s-.013.026-.013.042v.116c0 .018.004.033.011.047s.018.025.032.032c.013.008.03.012.049.012.014 0 .026-.002.037-.006.012-.003.021-.009.029-.016s.014-.016.018-.026h.179c-.006.038-.021.071-.044.098-.023.028-.053.05-.091.065-.037.015-.081.023-.132.023z" transform="matrix(71.99976445 0 0 72 59.93085955 61.8422)"/><path d="m.376-.545v.142h-.365v-.142zm-.295.545v-.561c0-.045.008-.082.024-.112s.039-.052.068-.066c.03-.015.064-.022.104-.022.025 0 .049.002.073.005.023.004.041.007.052.01l-.028.141c-.008-.002-.016-.004-.025-.005-.01-.002-.018-.002-.025-.002-.019 0-.031.004-.037.012-.007.007-.01.018-.01.03v.57z" transform="matrix(71.99976445 0 0 72 103.7026664 61.8422)"/><path d="m368 32h-56c-8.777 0-16 7.223-16 16v48h-48v-48c0-8.777-7.223-16-16-16h-80c-8.777 0-16 7.223-16 16v48h-47.9v-48c0-8.777-7.223-16-16-16h-56.1c-8.777 0-16 7.223-16 16v176l64 32c0 48.33-1.54 95-13.21 160h282.42c-11.67-65-13.21-112.28-13.21-160l64-32v-176c0-8.777-7.223-16-16-16zm-144 288h-64v-64c0-17.555 14.445-32 32-32s32 14.445 32 32z" transform="matrix(.0493687 0 0 .0493687 39.816 -1.58)"/></g></svg>
2+
<div class="text-xs flex justify-center items-center text-slate-400">
3+
<span class="mr-1">Secured by</span>
4+
<a href="https://opensensor.io" rel="noreferrer noopener" target="_blank" class="font-semibold text-teal-600 hover:text-teal-700">
5+
OpenSensor
66
</a>
77
</div>
88
{% endmacro %}

‎styles/globals.scss‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@
2121
}
2222

2323
:root {
24-
--color-primary-50: #fff1f2;
25-
--color-primary-100: #ffe4e6;
26-
--color-primary-200: #fecdd3;
27-
--color-primary-300: #fda4af;
28-
--color-primary-400: #fb7185;
29-
--color-primary-500: #f43f5e;
30-
--color-primary-600: #e11d48;
31-
--color-primary-700: #be123c;
32-
--color-primary-800: #9f1239;
33-
--color-primary-900: #881337;
34-
--color-accent: #1e293b;
24+
/* OpenSensor brand palette – teal/green */
25+
--color-primary-50: #f0fdfa;
26+
--color-primary-100: #ccfbf1;
27+
--color-primary-200: #99f6e4;
28+
--color-primary-300: #5eead4;
29+
--color-primary-400: #2dd4bf;
30+
--color-primary-500: #14b8a6;
31+
--color-primary-600: #0d9488;
32+
--color-primary-700: #0f766e;
33+
--color-primary-800: #115e59;
34+
--color-primary-900: #134e4a;
35+
--color-accent: #0f172a;
3536
--color-light: #e2e8f0;
3637
--color-light-hover: #cbd5e1;
37-
--color-input: #1e293b;
38+
--color-input: #0f172a;
3839
--color-bg-input: #ffffff;
3940

4041
font-size: 16px;

0 commit comments

Comments
 (0)