deploy resourced to production dockerfile

Note: I did not test the compose file on my machine before submitting the commit. May or may not work.
This commit is contained in:
blek 2023-11-11 17:58:50 +10:00
parent 27e386fb35
commit d299ea6e76
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 31 additions and 0 deletions

View File

@ -19,6 +19,15 @@ services:
volumes: volumes:
- './janitor:/config:ro' - './janitor:/config:ro'
- './volatile/files:/opt/user_uploads' - './volatile/files:/opt/user_uploads'
resourced:
build:
context: resource
dockerfile: Dockerfile.prod
networks:
bfile:
pid: host # prefork
volumes:
- './resource:/opt/cont'
caddy: caddy:
image: caddy:alpine image: caddy:alpine
volumes: volumes:

22
resource/Dockerfile.prod Normal file
View File

@ -0,0 +1,22 @@
FROM golang:alpine3.17 as builder
WORKDIR /opt/build
COPY . .
RUN apk add --no-cache git musl-dev upx binutils
RUN go build . && \
strip resourced && \
upx resourced
FROM alpine:3.17
WORKDIR /opt/code
COPY --from=builder /opt/build/resourced /usr/bin/resourced
# Note
# -----
# Since this is running with prefork, don't
# forget to set --pid=host when running this app
CMD [ "sh", "-c", "/usr/bin/resourced" ]