autobrr/Dockerfile
ze0s fe4f385a22
feat(database): connect postgres via socket and read config from env _FILE secrets (#2061)
* feat(database): connect postgres via socket

* feat(config): read env var secrets from file

* docs: explain env var secrets

* refactor: generate postgres dsn
2025-05-05 21:15:24 +02:00

61 lines
1.4 KiB
Docker

# build web
FROM node:20.17.0-alpine3.20 AS web-builder
# Update and enable Corepack
RUN npm install -g corepack@latest && \
corepack enable
WORKDIR /web
COPY web/package.json web/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY web ./
RUN pnpm run build
# build app
FROM golang:1.24-alpine3.21 AS app-builder
ARG VERSION=dev
ARG REVISION=dev
ARG BUILDTIME
RUN apk add --no-cache git build-base tzdata
ENV SERVICE=autobrr
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
COPY --from=web-builder /web/dist ./web/dist
COPY --from=web-builder /web/build.go ./web
#ENV GOOS=linux
#ENV CGO_ENABLED=0
RUN go build -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${REVISION} -X main.date=${BUILDTIME}" -o bin/autobrr cmd/autobrr/main.go && \
go build -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${REVISION} -X main.date=${BUILDTIME}" -o bin/autobrrctl cmd/autobrrctl/main.go
# build runner
FROM alpine:latest
LABEL org.opencontainers.image.source="https://github.com/autobrr/autobrr"
ENV HOME="/config" \
XDG_CONFIG_HOME="/config" \
XDG_DATA_HOME="/config"
RUN apk --no-cache add ca-certificates curl tzdata jq
WORKDIR /app
VOLUME /config
COPY --from=app-builder /src/bin/autobrr /usr/local/bin/
COPY --from=app-builder /src/bin/autobrrctl /usr/local/bin/
EXPOSE 7474
ENTRYPOINT ["/usr/local/bin/autobrr", "--config", "/config"]