forked from coracle/zooid
Add dockerfile and container build
This commit is contained in:
@@ -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
@@ -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"]
|
||||||
@@ -105,7 +105,7 @@ can_manage = true
|
|||||||
|
|
||||||
See `justfile` for defined commands.
|
See `justfile` for defined commands.
|
||||||
|
|
||||||
## Deployment
|
## Deploying on ubuntu
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Add a user
|
# 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
|
# 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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user