mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
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:
parent
cf5ec3b319
commit
2d7f44eeec
@ -9,10 +9,12 @@ release:
|
|||||||
before:
|
before:
|
||||||
hooks:
|
hooks:
|
||||||
- npm i
|
- npm i
|
||||||
- make precompile INTERNAL=on
|
- make precompile
|
||||||
builds:
|
builds:
|
||||||
- id: notray
|
- id: notray
|
||||||
dir: ./
|
dir: ./
|
||||||
|
flags:
|
||||||
|
- -tags={{ .Env.JFA_GO_TAG }}
|
||||||
ldflags:
|
ldflags:
|
||||||
- -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary {{.Env.JFA_GO_STRIP}} -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}"
|
- -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary {{.Env.JFA_GO_STRIP}} -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}"
|
||||||
goos:
|
goos:
|
||||||
@ -28,9 +30,10 @@ builds:
|
|||||||
- CGO_ENABLED=1
|
- CGO_ENABLED=1
|
||||||
- CC={{ if eq .Arch "amd64" }}x86_64{{ else if eq .Arch "arm64" }}aarch64{{ else }}{{ .Arch }}{{ end }}-linux-gnu{{ if eq .Arch "arm" }}eabihf{{ end }}-gcc
|
- CC={{ if eq .Arch "amd64" }}x86_64{{ else if eq .Arch "arm64" }}aarch64{{ else }}{{ .Arch }}{{ end }}-linux-gnu{{ if eq .Arch "arm" }}eabihf{{ end }}-gcc
|
||||||
- CXX={{ if eq .Arch "amd64" }}x86_64{{ else if eq .Arch "arm64" }}aarch64{{ else }}{{ .Arch }}{{ end }}-linux-gnu{{ if eq .Arch "arm" }}eabihf{{ end }}-gcc
|
- CXX={{ if eq .Arch "amd64" }}x86_64{{ else if eq .Arch "arm64" }}aarch64{{ else }}{{ .Arch }}{{ end }}-linux-gnu{{ if eq .Arch "arm" }}eabihf{{ end }}-gcc
|
||||||
|
- PKG_CONFIG_PATH=/usr/lib/{{ if eq .Arch "amd64" }}x86_64{{ else if eq .Arch "arm64" }}aarch64{{ else }}{{ .Arch }}{{ end }}-linux-gnu{{ if eq .Arch "arm" }}eabihf{{ end }}/pkgconfig:$PKG_CONFIG_PATH
|
||||||
- GOARM={{ if eq .Arch "arm" }}7{{ end }}
|
- GOARM={{ if eq .Arch "arm" }}7{{ end }}
|
||||||
flags:
|
flags:
|
||||||
- -tags=e2ee
|
- -tags=e2ee,{{ .Env.JFA_GO_TAG }}
|
||||||
ldflags:
|
ldflags:
|
||||||
- -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary {{.Env.JFA_GO_STRIP}} -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}"
|
- -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary {{.Env.JFA_GO_STRIP}} -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}"
|
||||||
goos:
|
goos:
|
||||||
@ -46,7 +49,7 @@ builds:
|
|||||||
- CC=x86_64-w64-mingw32-gcc
|
- CC=x86_64-w64-mingw32-gcc
|
||||||
- CXX=x86_64-w64-mingw32-g++
|
- CXX=x86_64-w64-mingw32-g++
|
||||||
flags:
|
flags:
|
||||||
- -tags=tray,e2ee
|
- -tags=tray,{{ .Env.JFA_GO_TAG }}
|
||||||
ldflags:
|
ldflags:
|
||||||
- -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary {{.Env.JFA_GO_STRIP}} -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}" -H=windowsgui
|
- -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary {{.Env.JFA_GO_STRIP}} -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}" -H=windowsgui
|
||||||
goos:
|
goos:
|
||||||
@ -59,9 +62,9 @@ builds:
|
|||||||
- CGO_ENABLED=1
|
- CGO_ENABLED=1
|
||||||
- CC=x86_64-linux-gnu-gcc
|
- CC=x86_64-linux-gnu-gcc
|
||||||
- CXX=x86_64-linux-gnu-gcc
|
- CXX=x86_64-linux-gnu-gcc
|
||||||
- PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
|
- PKG_CONFIG_PATH=/usr/lib/{{ if eq .Arch "amd64" }}x86_64{{ else if eq .Arch "arm64" }}aarch64{{ else }}{{ .Arch }}{{ end }}-linux-gnu{{ if eq .Arch "arm" }}eabihf{{ end }}/pkgconfig:$PKG_CONFIG_PATH
|
||||||
flags:
|
flags:
|
||||||
- -tags=tray,e2ee
|
- -tags=tray,e2ee,{{ .Env.JFA_GO_TAG }}
|
||||||
ldflags:
|
ldflags:
|
||||||
- -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary {{.Env.JFA_GO_STRIP}} -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}"
|
- -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary {{.Env.JFA_GO_STRIP}} -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}"
|
||||||
goos:
|
goos:
|
||||||
|
29
Dockerfile
29
Dockerfile
@ -1,31 +1,24 @@
|
|||||||
# Use this instead if hrfee/jfa-go-build-docker doesn't support your architecture
|
# Use this instead if hrfee/jfa-go-build-docker doesn't support your architecture
|
||||||
# FROM --platform=$BUILDPLATFORM golang:latest AS support
|
# FROM --platform=$BUILDPLATFORM golang:latest AS support
|
||||||
FROM --platform=$BUILDPLATFORM docker.io/hrfee/jfa-go-build-docker: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
|
COPY . /opt/build
|
||||||
|
|
||||||
# Uncomment this if hrfee/jfa-go-build-docker doesn't support your architecture
|
# RUN curl -sfL https://goreleaser.com/static/run > /goreleaser && chmod +x /goreleaser
|
||||||
# RUN apt-get update -y \
|
RUN cd /opt/build; INTERNAL=off ./scripts/version.sh /goreleaser build --auto-snapshot --skip=validate --clean --id notray-e2ee
|
||||||
# && apt-get install build-essential python3-pip -y \
|
RUN mv /opt/build/dist/*_linux_arm_6 /opt/build/dist/placeholder_linux_arm
|
||||||
# && (curl -sL https://deb.nodesource.com/setup_current.x | bash -) \
|
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
|
||||||
# && 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
|
|
||||||
|
|
||||||
ARG TARGETARCH
|
FROM golang:bookworm AS final
|
||||||
ENV GOARCH=$TARGETARCH
|
|
||||||
ARG BUILT_BY
|
RUN echo hello from arch ${TARGETARCH}
|
||||||
ENV BUILTBY=$BUILT_BY
|
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 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 8056
|
||||||
EXPOSE 8057
|
EXPOSE 8057
|
||||||
|
|
||||||
|
@ -15,6 +15,15 @@ else
|
|||||||
export JFA_GO_MINIFY=""
|
export JFA_GO_MINIFY=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${INTERNAL}" ]]; then
|
||||||
|
export INTERNAL=on
|
||||||
|
fi
|
||||||
|
if [[ "${INTERNAL}" == "on" ]]; then
|
||||||
|
export JFA_GO_TAG=""
|
||||||
|
else
|
||||||
|
export JFA_GO_TAG="external"
|
||||||
|
fi
|
||||||
|
|
||||||
JFA_GO_VERSION=$(git describe --exact-match HEAD 2> /dev/null || echo 'vgit')
|
JFA_GO_VERSION=$(git describe --exact-match HEAD 2> /dev/null || echo 'vgit')
|
||||||
TIMEOUT=60m
|
TIMEOUT=60m
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user