2024-12-07 02:05:44 +01:00
|
|
|
FROM golang:1.23.4-bookworm AS build
|
2024-02-16 23:01:12 +01:00
|
|
|
|
|
|
|
# Create build workspace folder
|
|
|
|
WORKDIR /workspace
|
|
|
|
ADD . /workspace
|
|
|
|
|
|
|
|
# Install updates and build tools
|
|
|
|
RUN apt-get update --yes && \
|
|
|
|
apt-get install --yes build-essential
|
|
|
|
|
|
|
|
# Build the actual binary
|
2024-07-30 21:21:34 +02:00
|
|
|
RUN CGO_ENABLED=0 go build -o grafana-backuper cmd/main.go
|
2024-02-16 23:01:12 +01:00
|
|
|
|
|
|
|
# -- -- -- -- -- --
|
|
|
|
|
|
|
|
# Set up image to run the tool
|
|
|
|
FROM alpine
|
|
|
|
|
|
|
|
# Create main app folder to run from
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Copy built binary from build image
|
2024-12-07 02:21:28 +01:00
|
|
|
COPY --from=build /workspace/grafana-backuper /app
|
2024-02-16 23:01:12 +01:00
|
|
|
|
2024-12-07 02:21:28 +01:00
|
|
|
RUN chmod +x /app/grafana-backuper
|
2024-12-07 00:52:25 +01:00
|
|
|
|
|
|
|
# Copy the wrapper script
|
2024-12-07 02:21:28 +01:00
|
|
|
COPY entrypoint.sh /app
|
2024-12-07 00:52:25 +01:00
|
|
|
|
|
|
|
# Ensure the script is executable
|
2024-12-07 02:21:28 +01:00
|
|
|
RUN chmod +x /app/entrypoint.sh
|
2024-12-07 00:52:25 +01:00
|
|
|
|
2024-12-07 02:21:28 +01:00
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|