ci: package prebuilt binary in docker images

GoReleaser's docker build context only carries the Dockerfile,
extra_files, and matching build artifacts — the inner
`goreleaser build` had no source or config and failed with
"couldn't guess project_name". Both images now consume the
cross-built `cloudreve` binary directly instead of rebuilding
inside the container.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
pull/3593/head
Tomas Dvorak 2 weeks ago
parent b9f4baaa2c
commit 01963f06d1

@ -1,19 +1,6 @@
# Build stage # Runtime image: packages the goreleaser-built `cloudreve` binary that is
# copied into the docker build context alongside this Dockerfile.
FROM ghcr.io/goreleaser/goreleaser:v2.10.2 AS builder
WORKDIR /src
# Install goreleaser
RUN apk add --no-cache bash curl git npm nodejs tar zip
RUN npm install -g yarn
# Perform the build
COPY . .
RUN goreleaser build --single-target --snapshot
# Runtime stage
FROM alpine:latest FROM alpine:latest
WORKDIR /cloudreve WORKDIR /cloudreve
@ -33,7 +20,7 @@ ENV CR_ENABLE_ARIA2=1 \
CR_SETTING_DEFAULT_thumb_libraw_enabled=1 CR_SETTING_DEFAULT_thumb_libraw_enabled=1
COPY .build/aria2.supervisor.conf .build/entrypoint.sh ./ COPY .build/aria2.supervisor.conf .build/entrypoint.sh ./
COPY --from=builder /src/dist/*/cloudreve ./cloudreve COPY cloudreve ./cloudreve
RUN chmod +x ./cloudreve \ RUN chmod +x ./cloudreve \
&& chmod +x ./entrypoint.sh && chmod +x ./entrypoint.sh
@ -43,4 +30,3 @@ EXPOSE 5212 443 6888 6888/udp
VOLUME ["/cloudreve/data"] VOLUME ["/cloudreve/data"]
ENTRYPOINT ["sh", "./entrypoint.sh"] ENTRYPOINT ["sh", "./entrypoint.sh"]

@ -1,20 +1,6 @@
# Slim variant: no LibreOffice, fonts, aria2, or media/thumbnail tooling. # Slim variant: no LibreOffice, fonts, aria2, or media/thumbnail tooling.
# Build stage # Packages the goreleaser-built `cloudreve` binary from the build context.
FROM ghcr.io/goreleaser/goreleaser:v2.10.2 AS builder
WORKDIR /src
# Install goreleaser
RUN apk add --no-cache bash curl git npm nodejs tar zip
RUN npm install -g yarn
# Perform the build
COPY . .
RUN goreleaser build --single-target --snapshot
# Runtime stage
FROM alpine:latest FROM alpine:latest
WORKDIR /cloudreve WORKDIR /cloudreve
@ -24,7 +10,7 @@ RUN apk update \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone && echo "Asia/Shanghai" > /etc/timezone
COPY --from=builder /src/dist/*/cloudreve ./cloudreve COPY cloudreve ./cloudreve
RUN chmod +x ./cloudreve RUN chmod +x ./cloudreve

Loading…
Cancel
Save