build brudi from source

This commit is contained in:
s83 2024-07-06 12:12:16 +02:00
parent e1f5bb67dd
commit 8abd1a0b8e

View File

@ -1,15 +1,39 @@
# # Add build-base package for compiling source code
# RUN apk add --no-cache --upgrade build-base
# syntax=docker/dockerfile:1
# # Clone the brudi source code from GitHub
# RUN git clone https://github.com/mittwald/brudi.git /tmp/brudi
# Stage 1: Build the binary
FROM golang:1.22.5-alpine AS brudi_builder
# # Build brudi from source for arm architecture
# WORKDIR /tmp/brudi
# RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -o /usr/local/bin/brudi
# Set necessary environment variables needed for our image
ENV GO111MODULE=on \
CGO_ENABLED=0
# Set the Current Working Directory inside the container
WORKDIR /build
# Install git
RUN apk add --no-cache git
# Clone the repository
RUN git clone https://github.com/mittwald/brudi.git .
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download
# Build the Go app for the current architecture
RUN go build -o brudi
# # Stage 2: Create the final image
# FROM alpine:latest
# # Set the Current Working Directory inside the container
# WORKDIR /app
# # Copy the pre-built binary from the builder stage
# COPY --from=builder /build/brudi .
# # Command to run the binary
# CMD ["./brudi"]
# # Clean up the temporary directory
# RUN rm -rf /tmp/brudi
FROM postgres:16.2-alpine3.19
@ -18,8 +42,8 @@ LABEL maintainer="s83 <https://github.com/s83>"
ENV BRUDI_USER="brudi" \
BRUDI_GID="1000" \
BRUDI_UID="1000"
COPY --from=quay.io/mittwald/brudi:0.1 /usr/local/bin/brudi /usr/local/bin/brudi
COPY --from=brudi_builder /build/brudi /usr/local/bin/brudi
COPY --from=restic/restic:0.16.4 /usr/bin/restic /usr/local/bin/restic
COPY --from=redis:7.2.4-alpine3.19 /usr/local/bin/redis-cli /usr/local/bin/redis-cli