quadlet added

This commit is contained in:
XenGi 2024-08-08 00:05:49 +02:00
parent 534077bad3
commit 73f65e00ba
Signed by: xengi
SSH key fingerprint: SHA256:jxWM2RTHvxxcncXycwwWkP7HCWb4VREN05UGJTbIPZg
3 changed files with 38 additions and 16 deletions

View file

@ -1,17 +1,12 @@
FROM docker.io/golang:1.22 as builder FROM docker.io/golang:1.22 as builder
WORKDIR /app WORKDIR /usr/src/app
COPY . ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download && go mod verify
RUN CGO_ENABLED=0 GOOS=linux go build -o /sanic COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -v -o sanic ./...
# -----
FROM builder AS tester
RUN go test -v ./...
# ----- # -----
@ -19,8 +14,8 @@ FROM scratch as runner
WORKDIR / WORKDIR /
COPY --from=builder /sanic /sanic COPY --from=builder /usr/src/app/sanic /sanic
COPY --from=builder /app/static /static COPY --from=builder /usr/src/app/static /static
EXPOSE 8080 EXPOSE 8080

View file

@ -56,12 +56,12 @@ Install from the AUR:
yay -S sanic yay -S sanic
``` ```
### Podman ### 🐳 Container
Run as daemon: Run as daemon:
```shell ```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 ## 🛠️ 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`. Run local [MPD][mpd] instance for testing with `make mpd`.
Update go depdendencies like this: Update go dependencies like this:
```shell ```shell
go get -u # or `make update` go get -u # or `make update`
@ -94,7 +94,7 @@ nix build
### 🐧 w/o Nix ### 🐧 w/o Nix
Use these Make targets for convenience: Use these Make targets for your convenience:
- `run`: Run project - `run`: Run project
- `build`: Compile project - `build`: Compile project

27
sanic.container Normal file
View file

@ -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