woodpecker-docker-buildx/Dockerfile.multiarch
6543 b85ee124e2 Ensure that the plugin binary does not conflict with the utility being used (#24)
use methode described in https://docs.docker.com/build/buildx/install/ to install buildx into image.
- `/usr/lib/docker/cli-plugins/docker-buildx` -> `/usr/libexec/docker/cli-plugins/docker-buildx`
- fix linux/amd64 build on linux/arm64

rename plugin binary
- `docker-buildx` -> `plugin-docker-buildx`

Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/24
Reviewed-by: anbraten <anbraten@noreply.codeberg.org>
2022-10-08 00:58:57 +02:00

24 lines
661 B
Docker

ARG BUILDX_VERSION=0.9.1
ARG DOCKER_VERSION=20.10-dind
ARG GOLANG_VERSION=1.18
FROM --platform=$BUILDPLATFORM golang:${GOLANG_VERSION} as build
COPY . /src
WORKDIR /src
ARG TARGETOS TARGETARCH
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
make build
FROM docker/buildx-bin:${BUILDX_VERSION} as buildx-bin
FROM docker:${DOCKER_VERSION}
COPY --from=buildx-bin /buildx /usr/libexec/docker/cli-plugins/docker-buildx
COPY --from=build /src/plugin-docker-buildx /bin/plugin-docker-buildx
ENV DOCKER_HOST=unix:///var/run/docker.sock
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "plugin-docker-buildx"]