-
-
Notifications
You must be signed in to change notification settings - Fork 802
Docker multiarch image #703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7c17433
Initial proof of concept (#257)
eternal-flame-AD decd463
Add tests to image build process
eternal-flame-AD 721aecf
Merge in gotify/build image
eternal-flame-AD ce9abd8
Merge branch 'master' into docker-multiarch
eternal-flame-AD 3a1f880
Fix build pipeline
eternal-flame-AD 037ce55
fixup! Fix build pipeline
eternal-flame-AD 377ef3c
Use registry output for Github Actions
eternal-flame-AD 6a2803a
Address go build suggestions
eternal-flame-AD f833d20
Switch to using official node Docker image
eternal-flame-AD 02f2212
Unify debian editions to sid
eternal-flame-AD a5e9fb4
Remove unused makefile recipes
eternal-flame-AD 486f7fa
Address suggestions
eternal-flame-AD eeb2984
Add .dockerignore
eternal-flame-AD 0bbf37a
Cosmetic fixes
eternal-flame-AD c427fde
add node_modules to dockerignore
eternal-flame-AD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| vendor/ | ||
| .idea/ | ||
| build/ | ||
| licenses/ | ||
| coverage.txt | ||
| data/ | ||
| images/ | ||
| .git/ | ||
| */node_modules/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,74 @@ | ||
| FROM amd64/debian:stable-slim | ||
| ENV GOTIFY_SERVER_PORT="80" | ||
| ARG BUILDKIT_SBOM_SCAN_CONTEXT=true | ||
jmattheis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Suppress warning about invalid variable expansion | ||
| ARG GO_VERSION=PLEASE_PROVIDE_GO_VERSION | ||
| ARG DEBIAN=sid-slim | ||
|
|
||
| # Hack to normalize platform to match the chosed build image | ||
| # Get the gotify/build image tag | ||
| ARG __TARGETPLATFORM_DASHES=${TARGETPLATFORM/\//-} | ||
| ARG __TARGETPLATFORM_GO_NOTATION=${__TARGETPLATFORM_DASHES/arm\/v7/arm-7} | ||
|
|
||
| # --- JS Builder --- | ||
|
|
||
| FROM --platform=${BUILDPLATFORM} node:23 AS js-builder | ||
|
|
||
| ARG BUILD_JS=0 | ||
|
|
||
| COPY ./Makefile /src/gotify/Makefile | ||
| COPY ./ui /src/gotify/ui | ||
|
|
||
| RUN if [ "$BUILD_JS" = "1" ]; then \ | ||
| (cd /src/gotify/ui && yarn install) && \ | ||
| (cd /src/gotify && make build-js) \ | ||
| else \ | ||
| mkdir -p /src/gotify/ui/build; \ | ||
| fi | ||
|
|
||
| # --- Go Builder --- | ||
|
|
||
| FROM --platform=${BUILDPLATFORM} gotify/build:${GO_VERSION}-${__TARGETPLATFORM_GO_NOTATION} AS builder | ||
eternal-flame-AD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ARG BUILDPLATFORM | ||
| ARG TARGETPLATFORM | ||
| ARG BUILD_JS=0 | ||
eternal-flame-AD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ARG RUN_TESTS=0 # 0=never, 1=native only | ||
| ARG LD_FLAGS="" | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update && apt-get install -yq --no-install-recommends \ | ||
| ca-certificates \ | ||
| git | ||
|
|
||
| COPY . /src/gotify | ||
| COPY --from=js-builder /src/gotify/ui/build /ui-build | ||
|
|
||
| RUN if [ "$BUILD_JS" = "1" ]; then \ | ||
| cp -r --update /ui-build /src/gotify/ui/build; \ | ||
| fi | ||
|
|
||
| RUN cd /src/gotify && \ | ||
| if [ "$RUN_TESTS" = "1" ] && [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \ | ||
| go test -v ./...; \ | ||
| fi && \ | ||
| LD_FLAGS=${LD_FLAGS} make OUTPUT=/target/app/gotify-app _build_within_docker | ||
|
|
||
| FROM debian:${DEBIAN} | ||
|
|
||
| # Build-time configurables | ||
| ARG GOTIFY_SERVER_EXPOSE=80 | ||
jmattheis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ENV GOTIFY_SERVER_PORT=$GOTIFY_SERVER_EXPOSE | ||
|
|
||
| WORKDIR /app | ||
| RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -yq \ | ||
| tzdata \ | ||
| curl \ | ||
| ca-certificates \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| ADD gotify-app /app/ | ||
|
|
||
| RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -yq --no-install-recommends \ | ||
| tzdata \ | ||
| curl \ | ||
| ca-certificates && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| HEALTHCHECK --interval=30s --timeout=5s --start-period=5s CMD curl --fail http://localhost:$GOTIFY_SERVER_PORT/health || exit 1 | ||
eternal-flame-AD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| EXPOSE 80 | ||
| EXPOSE $GOTIFY_SERVER_EXPOSE | ||
|
|
||
| COPY --from=builder /target / | ||
|
|
||
| ENTRYPOINT ["./gotify-app"] | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.