Skip to content

Commit b3aa08c

Browse files
authored
Merge pull request #3 from constructions-incongrues/gha-image
feat: add Docker image for Faircamp 1.4.0 with CI workflow
2 parents 24955c8 + b9c9227 commit b3aa08c

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

.github/workflows/image.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#
2+
name: Create and publish a Docker image
3+
4+
# Configures this workflow to run every time a change is pushed to the branch called `release`.
5+
on:
6+
push:
7+
branches: [main]
8+
# only when relevant files are changed
9+
paths:
10+
- Dockerfile
11+
- .github/workflows/image.yml
12+
- requirements.txt
13+
14+
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
15+
env:
16+
REGISTRY: ghcr.io
17+
IMAGE_NAME: ${{ github.repository }}
18+
19+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
20+
jobs:
21+
build-and-push-image:
22+
runs-on: ubuntu-latest
23+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
24+
permissions:
25+
contents: read
26+
packages: write
27+
attestations: write
28+
id-token: write
29+
#
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
34+
- name: Log in to the Container registry
35+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
41+
- name: Extract metadata (tags, labels) for Docker
42+
id: meta
43+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
44+
with:
45+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
47+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
48+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
49+
- name: Build and push Docker image
50+
id: push
51+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
52+
with:
53+
context: .
54+
push: true
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}
57+
58+
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
59+
- name: Generate artifact attestation
60+
uses: actions/attest-build-provenance@v2
61+
with:
62+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
63+
subject-digest: ${{ steps.push.outputs.digest }}
64+
push-to-registry: true
65+

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# syntax=docker/dockerfile:1.4
2+
# Based on https://github.com/n3wjack/faircamp-docker
3+
4+
FROM --platform=linux/amd64 python:3.13-slim-bookworm AS base
5+
6+
# Install dependencies
7+
COPY requirements.txt /tmp/requirements.txt
8+
RUN pip install --no-cache-dir -r /tmp/requirements.txt
9+
10+
RUN apt-get update && \
11+
apt-get install --no-install-recommends --yes ffmpeg libvips42 curl
12+
13+
# Install Faircamp
14+
ARG VERSION=1.4.0
15+
16+
RUN mkdir /fc
17+
WORKDIR /fc
18+
19+
RUN curl -Lvk https://simonrepp.com/faircamp/packages/faircamp_$VERSION-1+deb12_amd64.deb -o faircamp.deb
20+
21+
RUN dpkg --install /fc/faircamp.deb && \
22+
apt-get install --no-install-recommends --yes -f && \
23+
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
24+
rm /fc/faircamp.deb
25+
26+
# Setup the working folder.
27+
RUN mkdir /data
28+
WORKDIR /data
29+
30+
# Run Faircamp. Any arguments passed to docker will be passed to Faircamp.
31+
ENTRYPOINT ["faircamp"]

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
enolib==0.8.1
2+
mutagen==1.47.0

0 commit comments

Comments
 (0)