build: use goreleaser within dockerfile

jfa-go-build-docker has also been updated with libolm deps for all
arches, and version.sh now tells goreleaser to do internal or external.
This commit is contained in:
Harvey Tindall
2024-08-11 16:28:21 +01:00
parent cf5ec3b319
commit 2d7f44eeec
3 changed files with 28 additions and 23 deletions
+11 -18
View File
@@ -1,31 +1,24 @@
# Use this instead if hrfee/jfa-go-build-docker doesn't support your architecture
# FROM --platform=$BUILDPLATFORM golang:latest AS support
FROM --platform=$BUILDPLATFORM docker.io/hrfee/jfa-go-build-docker:latest AS support
ARG BUILT_BY
ENV JFA_GO_BUILT_BY=$BUILT_BY
COPY . /opt/build
# Uncomment this if hrfee/jfa-go-build-docker doesn't support your architecture
# RUN apt-get update -y \
# && apt-get install build-essential python3-pip -y \
# && (curl -sL https://deb.nodesource.com/setup_current.x | bash -) \
# && apt-get install nodejs
RUN (cd /opt/build; npm i; make precompile INTERNAL=off GOESBUILD=off) \
&& sed -i 's#id="password_resets-watch_directory" placeholder="/config/jellyfin"#id="password_resets-watch_directory" value="/jf" disabled#g' /opt/build/build/data/html/setup.html
# RUN curl -sfL https://goreleaser.com/static/run > /goreleaser && chmod +x /goreleaser
RUN cd /opt/build; INTERNAL=off ./scripts/version.sh /goreleaser build --auto-snapshot --skip=validate --clean --id notray-e2ee
RUN mv /opt/build/dist/*_linux_arm_6 /opt/build/dist/placeholder_linux_arm
RUN sed -i 's#id="password_resets-watch_directory" placeholder="/config/jellyfin"#id="password_resets-watch_directory" value="/jf" disabled#g' /opt/build/build/data/html/setup.html
ARG TARGETARCH
ENV GOARCH=$TARGETARCH
ARG BUILT_BY
ENV BUILTBY=$BUILT_BY
FROM golang:bookworm AS final
RUN echo hello from arch ${TARGETARCH}
COPY --from=support /opt/build/dist/*_linux_${TARGETARCH}* /opt/jfa-go
COPY --from=support /opt/build/build/data /opt/jfa-go/
RUN apt-get update -y && apt-get install libolm-dev -y
RUN (cd /opt/build; make compile INTERNAL=off UPDATER=docker)
FROM golang:bookworm
RUN apt-get update -y && apt-get install libolm-dev -y
COPY --from=support /opt/build/build /opt/jfa-go
EXPOSE 8056
EXPOSE 8057