feat: add arg forwarding to docker-entrypoint and backrestmon
Some checks failed
Build Snapshot Release / build (push) Has been cancelled
Release Please / release-please (push) Has been cancelled
Test / test-nix (push) Has been cancelled
Test / test-win (push) Has been cancelled
Update Restic / update-restic-version (push) Has been cancelled

This commit is contained in:
Gareth George
2025-08-03 10:58:32 -07:00
parent bb0604a141
commit 42054f4a22
3 changed files with 7 additions and 4 deletions

View File

@@ -1,7 +1,8 @@
FROM golang:1.24-alpine AS builder
WORKDIR /src
COPY . .
RUN go build -o /docker-entrypoint ./cmd/docker-entrypoint
RUN go build -o /docker-entrypoint -ldflags "-s -w" ./cmd/docker-entrypoint
FROM alpine:latest
LABEL org.opencontainers.image.source="https://github.com/garethgeorge/backrest"

View File

@@ -1,7 +1,7 @@
FROM golang:1.24-alpine AS builder
WORKDIR /src
COPY . .
RUN go build -o /docker-entrypoint ./cmd/docker-entrypoint
RUN go build -o /docker-entrypoint -ldflags "-s -w" ./cmd/docker-entrypoint
FROM alpine:latest AS alpine
RUN apk add --no-cache ca-certificates tini-static

View File

@@ -28,9 +28,11 @@ func main() {
os.Stderr.WriteString("No command provided to run.\n")
os.Exit(1)
}
os.Stderr.WriteString("Running command: " + os.Args[1] + " " + fmt.Sprint(os.Args[2:]) + "\n")
subcommand := os.Args[1]
args := os.Args[2:]
os.Stderr.WriteString("Running command: " + subcommand + " " + fmt.Sprint(args) + "\n")
cmd := exec.Command(os.Args[1], os.Args[2:]...)
cmd := exec.Command(subcommand, args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin