mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Use BuildKit/buildx autopopulated ARGs for getting builder image
This commit is contained in:
parent
321abc4071
commit
699842748f
12
.github/workflows/Dockerfile.copyin
vendored
12
.github/workflows/Dockerfile.copyin
vendored
|
|
@ -1,12 +1,16 @@
|
||||||
|
ARG builder
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
# https://stackoverflow.com/a/63472135/3551604
|
||||||
|
FROM ${TARGETARCH}/${builder}:latest as builder
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
ARG BUILDER=
|
ARG DENDRITE_BINARY
|
||||||
ARG BUILDER_TAG=
|
|
||||||
ARG DENDRITE_BINARY=
|
|
||||||
|
|
||||||
ENV DENDRITE_BINARY=${DENDRITE_BINARY}
|
ENV DENDRITE_BINARY=${DENDRITE_BINARY}
|
||||||
|
|
||||||
COPY --from=${BUILDER}:${BUILDER_TAG} /build/bin/* /usr/bin
|
COPY --from=builder /build/bin/* /usr/bin/
|
||||||
|
|
||||||
VOLUME /etc/dendrite
|
VOLUME /etc/dendrite
|
||||||
WORKDIR /etc/dendrite
|
WORKDIR /etc/dendrite
|
||||||
|
|
|
||||||
7
.github/workflows/cross-compiling-docker.yml
vendored
7
.github/workflows/cross-compiling-docker.yml
vendored
|
|
@ -20,6 +20,8 @@ jobs:
|
||||||
- 5000:5000
|
- 5000:5000
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
- name: set docker target
|
||||||
|
run: echo "DOCKER_TARGET=$(./.github/workflows/get-compiler.sh docker)" >> $GITHUB_ENV
|
||||||
- uses: docker/setup-buildx-action@v1
|
- uses: docker/setup-buildx-action@v1
|
||||||
with:
|
with:
|
||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
|
|
@ -29,10 +31,9 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
file: ./.github/workflows/Dockerfile.builder
|
file: ./.github/workflows/Dockerfile.builder
|
||||||
load: true # load into local image store
|
load: true # load into local image store
|
||||||
tags: "${{ env.BUILDER_IMAGE_NAME }}:${{ matrix.target }}"
|
tags: "${{ env.DOCKER_TARGET }}/${{ env.BUILDER_IMAGE_NAME }}:latest"
|
||||||
build-args: "GOARCH=${{ env.GOARCH }}"
|
build-args: "GOARCH=${{ env.GOARCH }}"
|
||||||
# - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
# - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||||
- run: echo "DOCKER_TARGET=$(./.github/workflows/get-compiler.sh docker)" >> $GITHUB_ENV
|
|
||||||
- uses: docker/setup-qemu-action@v1
|
- uses: docker/setup-qemu-action@v1
|
||||||
- name: build monolith
|
- name: build monolith
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
|
|
@ -42,4 +43,4 @@ jobs:
|
||||||
platforms: ${{ env.DOCKER_TARGET }}
|
platforms: ${{ env.DOCKER_TARGET }}
|
||||||
push: true
|
push: true
|
||||||
tags: localhost:5000/matrixdotorg/dendrite-monolith:latest
|
tags: localhost:5000/matrixdotorg/dendrite-monolith:latest
|
||||||
build-args: "BUILDER=${{ env.BUILDER_IMAGE_NAME }}\nBUILDER_TAG=${{ env.GOARCH }}\nDENDRITE_BINARY=dendrite-monolith-server"
|
build-args: "builder=${{ env.BUILDER_IMAGE_NAME }}\nDENDRITE_BINARY=dendrite-monolith-server"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue