Add dockerfile and container build

This commit is contained in:
Jon Staab
2025-09-30 17:26:21 -07:00
parent 67a00e71ee
commit 012f04569c
3 changed files with 100 additions and 4 deletions
+59
View File
@@ -0,0 +1,59 @@
name: Docker
on:
push:
branches: ['master']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
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 }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
+28
View File
@@ -0,0 +1,28 @@
FROM golang AS build
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY zooid zooid
COPY cmd cmd
RUN CGO_ENABLED=0 GOOS=linux go build -o bin/zooid cmd/relay/main.go
FROM gcr.io/distroless/base-debian12 AS run
WORKDIR /
COPY --from=build /app/bin/zooid /bin/zooid
USER nonroot:nonroot
EXPOSE 3334
ENV CONFIG=/tmp/config
ENV MEDIA=/tmp/media
ENV DATA=/tmp/data
ENTRYPOINT ["/bin/zooid"]
+13 -4
View File
@@ -105,7 +105,7 @@ can_manage = true
See `justfile` for defined commands.
## Deployment
## Deploying on ubuntu
```sh
# Add a user
@@ -139,7 +139,16 @@ service zooid start
# Next, optionally set up a reverse proxy and create a config file for each virtual relay
```
## TODO
## Deploying via container
Zooid can be run using an OCI container:
```sh
podman run -it \
-p 3334:3334 \
-v ./config:/tmp/config \
-v ./media:/tmp/media \
-v ./data:/tmp/data \
ghcr.io/coracle-social/zooid
```
- [ ] Free up resources after instance inactivity
- [ ] Admin/member lists