From 73f65e00ba1a95d11884820e526418bbe8a4d562 Mon Sep 17 00:00:00 2001 From: Ricardo Band Date: Thu, 8 Aug 2024 00:05:49 +0200 Subject: [PATCH] quadlet added --- Dockerfile | 19 +++++++------------ README.md | 8 ++++---- sanic.container | 27 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 sanic.container diff --git a/Dockerfile b/Dockerfile index 0b51d8f..2c1e850 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,12 @@ FROM docker.io/golang:1.22 as builder -WORKDIR /app +WORKDIR /usr/src/app -COPY . ./ -RUN go mod download +COPY go.mod go.sum ./ +RUN go mod download && go mod verify -RUN CGO_ENABLED=0 GOOS=linux go build -o /sanic - -# ----- - -FROM builder AS tester - -RUN go test -v ./... +COPY . . +RUN CGO_ENABLED=0 GOOS=linux go build -v -o sanic ./... # ----- @@ -19,8 +14,8 @@ FROM scratch as runner WORKDIR / -COPY --from=builder /sanic /sanic -COPY --from=builder /app/static /static +COPY --from=builder /usr/src/app/sanic /sanic +COPY --from=builder /usr/src/app/static /static EXPOSE 8080 diff --git a/README.md b/README.md index 5ae986e..066e428 100644 --- a/README.md +++ b/README.md @@ -56,12 +56,12 @@ Install from the AUR: yay -S sanic ``` -### Podman +### 🐳 Container Run as daemon: ```shell -podman run -d -v ./config.ini:/config.ini -p 8443:8443 registry.gitlab.com/XenGi/sanic:latest +podman run -d -v ./config.ini:/config.ini -p 8080:8080 registry.gitlab.com/XenGi/sanic:latest ``` ## 🛠️ Development @@ -70,7 +70,7 @@ sanic is developed using [Nix][nix], but you can also just use the usual Golang Run local [MPD][mpd] instance for testing with `make mpd`. -Update go depdendencies like this: +Update go dependencies like this: ```shell go get -u # or `make update` @@ -94,7 +94,7 @@ nix build ### 🐧 w/o Nix -Use these Make targets for convenience: +Use these Make targets for your convenience: - `run`: Run project - `build`: Compile project diff --git a/sanic.container b/sanic.container new file mode 100644 index 0000000..9a4a98f --- /dev/null +++ b/sanic.container @@ -0,0 +1,27 @@ +[Unit] +Description=sanic - chaos music control + +[Container] +AutoUpdate=registry +ContainerName=sanic +Group=sanic +HealthCmd=/usr/bin/curl localhost:8080/echo +HealthInterval=2m +HealthOnFailure=restart +HealthRetries=5 +HealthStartPeriod=1m +Image=registry.gitlab.com/xengi/sanic/sanic:latest +LogDriver=journald +Network=host +NoNewPrivileges=true +PublishPort=8080 +Pull=always +User=sanic +Volume=/etc/sanic/config.ini:/config.ini + +[Service} +Restart=always + +[Install] +WantedBy=default.target +