diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf0e362..fdb6f69 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,10 @@ on: push: pull_request: +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: build: runs-on: ubuntu-24.04 @@ -11,5 +15,30 @@ jobs: contents: read steps: - uses: actions/checkout@v4 + - uses: mlugg/setup-zig@v1 + - run: zig build test --summary all + - run: zig build + + - name: Log in to the Container registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..23d8a34 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu:24.04 + +RUN useradd -m -s /bin/bash -u 1000 acoustid + +ADD zig-out/bin/fpindex /usr/bin + +RUN mkdir -p /var/lib/acoustid/fpindex && chown -R acoustid /var/lib/acoustid/fpindex +VOLUME ["/var/lib/acoustid/fpindex"] + +USER acoustid +EXPOSE 6080 + +CMD ["fpindex", "--dir", "/var/lib/acoustid/fpindex", "--address", "0.0.0.0", "--port", "6080"] \ No newline at end of file