From ad77710ad1e9adf5fed14bd0470a5460966c85d0 Mon Sep 17 00:00:00 2001 From: "Urko." Date: Mon, 29 Apr 2024 21:50:35 +0200 Subject: [PATCH] fix: Dockerfile --- Dockerfile | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index b55e971..b31d610 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,29 +2,27 @@ FROM golang:1.22 as builder WORKDIR /app +# Copy the local package files to the container's workspace. COPY go.mod go.sum ./ RUN go mod download -COPY internal ./internal -COPY pk ./pk -ARG PORT -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /app/webhook-ci /app/main.go +# Copy the project code into the container +COPY . . -FROM alpine:3.15 +# Build the Go app +RUN CGO_ENABLED=0 GOOS=linux go build -v -o git-webhook-ci -# Install ca-certificates, ffmpeg (which includes ffprobe), Python, and yt-dlp -RUN apk --no-cache add ca-certificates ffmpeg python3 py3-pip \ - && python3 -m venv /opt/venv \ - && source /opt/venv/bin/activate \ - && pip install --no-cache-dir yt-dlp +# Use a small Alpine Linux image +FROM alpine:latest -ENV PATH="/opt/venv/bin:$PATH" +# Set the working directory +WORKDIR /root/ -COPY --from=builder /app/banana-byte /app/banana-byte -COPY --from=builder /app/web /app/web +# Copy the binary from the builder stage +COPY --from=builder /app/git-webhook-ci . -ENV VIEWS_DIR="/app/web" +# Document that the service listens on port 8080. +EXPOSE 8080 -EXPOSE $PORT - -CMD ["/app/banana-byte"] +# Run the binary. +CMD ["./git-webhook-ci"]