add container and go stuff
This commit is contained in:
parent
8161b5d92b
commit
cfaa05f7b5
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
FROM docker.io/golang:1.20 as builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /sanic
|
||||||
|
|
||||||
|
# -----
|
||||||
|
|
||||||
|
FROM builder AS tester
|
||||||
|
|
||||||
|
RUN go test -v ./...
|
||||||
|
|
||||||
|
# -----
|
||||||
|
|
||||||
|
FROM scratch as runner
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
COPY --from=builder /sanic /sanic
|
||||||
|
COPY --from=builder /app/static /static
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
ENTRYPOINT ["/sanic"]
|
22
Makefile
22
Makefile
|
@ -2,3 +2,25 @@ mpd:
|
||||||
mkdir -p /tmp/sanic/{music,playlists}
|
mkdir -p /tmp/sanic/{music,playlists}
|
||||||
touch /tmp/sanic/mpd_db
|
touch /tmp/sanic/mpd_db
|
||||||
mpd --no-daemon ./mpd.conf
|
mpd --no-daemon ./mpd.conf
|
||||||
|
|
||||||
|
run: build
|
||||||
|
./server
|
||||||
|
|
||||||
|
build:
|
||||||
|
go build -v -o sanic
|
||||||
|
|
||||||
|
tidy: ## add missing and remove unused modules
|
||||||
|
go mod tidy
|
||||||
|
|
||||||
|
verify: ## verify dependencies have expected content
|
||||||
|
go mod verify
|
||||||
|
|
||||||
|
test: ## run tests
|
||||||
|
go test ./...
|
||||||
|
|
||||||
|
cert: ## create https certificate for testing
|
||||||
|
go run $GOROOT/src/crypto/tls/generate_cert.go --host localhost
|
||||||
|
|
||||||
|
container:
|
||||||
|
podman build -t dotfiles:latest .
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ port = 6600
|
||||||
#pasword =
|
#pasword =
|
||||||
|
|
||||||
[ui]
|
[ui]
|
||||||
hostname = localhost
|
hostname = 0.0.0.0
|
||||||
port = 8080
|
port = 8080
|
||||||
tls = no
|
tls = no
|
||||||
cert = cert.pem
|
cert = cert.pem
|
||||||
|
|
Loading…
Reference in a new issue