cc6844605f
The agent writes its encrypted secrets blob to $DefaultSecretsPath (/var/lib/restic-manager/secrets.enc) but the e2e fixtures created and mounted a directory at /var/lib/restic-manager-agent — name mismatch. Result: every `config.update` push failed with 'create tmp: no such file or directory', the auto-init never got the repo creds, the host landed in init_failed, and the smoke test couldn't kick off a backup (the Run backup button is disabled while repo_status != ready). Align the compose volume mount and the Dockerfile mkdir on /var/lib/restic-manager so they match the production install script + the agent's own default.
43 lines
1.5 KiB
Docker
43 lines
1.5 KiB
Docker
# Build a Linux container that runs the restic-manager agent against a
|
|
# sibling rest-server in the e2e compose stack. Used only by tests
|
|
# (e2e/compose.e2e.yml + .gitea/workflows/e2e.yml).
|
|
#
|
|
# Two stages:
|
|
# 1. golang:alpine to build the agent binary.
|
|
# 2. alpine:3.20 with the `restic` package + the built binary.
|
|
#
|
|
# Pinning by digest is intentional for CI reproducibility.
|
|
|
|
FROM golang:1.25-alpine AS build
|
|
WORKDIR /src
|
|
|
|
ENV CGO_ENABLED=0 \
|
|
GOFLAGS="-trimpath"
|
|
|
|
COPY go.mod go.sum* ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
ARG VERSION=e2e
|
|
RUN go build -ldflags="-s -w -X gitea.dcglab.co.uk/steve/restic-manager/internal/version.Version=${VERSION}" \
|
|
-o /out/restic-manager-agent ./cmd/agent
|
|
|
|
FROM alpine:3.20
|
|
RUN apk add --no-cache restic ca-certificates curl
|
|
COPY --from=build /out/restic-manager-agent /usr/local/bin/restic-manager-agent
|
|
|
|
# Agents normally run as root because backup paths often need it. The
|
|
# e2e fixture only backs up paths under /data which we own, so this
|
|
# container would tolerate a non-root user — but staying root keeps
|
|
# parity with the production install.
|
|
USER root
|
|
|
|
# The agent needs a writable directory for its config + secrets store.
|
|
RUN mkdir -p /etc/restic-manager /var/lib/restic-manager
|
|
ENV RM_AGENT_CONFIG=/etc/restic-manager/agent.yaml
|
|
|
|
# The compose entrypoint sets the announce URL via env.
|
|
COPY e2e/agent-entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|