Skip to content

Commit d42c711

Browse files
committed
use single Dockerfile for both docker-machine and gitlab-runner images
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
1 parent 9e30cf2 commit d42c711

3 files changed

Lines changed: 14 additions & 39 deletions

File tree

Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# renovate: datasource=gitlab-tags depName=gitlab-org/gitlab-runner versioning=semver
2+
ARG GITLAB_RUNNER_VERSION=v16.9.1
3+
ARG GITLAB_RUNNER_IMAGE=gitlab/gitlab-runner:alpine-${GITLAB_RUNNER_VERSION}
4+
15
FROM golang:alpine
26

37
WORKDIR /docker-machine-driver-scaleway
@@ -23,8 +27,14 @@ ARG DOCKER_MACHINE_VERSION=v0.16.2-gitlab.21
2327
RUN git clone --branch=${DOCKER_MACHINE_VERSION} https://gitlab.com/gitlab-org/ci-cd/docker-machine .
2428
RUN CGO_ENABLED=0 GO111MODULE=off go build -o docker-machine -trimpath -ldflags="-s -w" ./cmd/docker-machine
2529

30+
FROM ${GITLAB_RUNNER_IMAGE} as gitlab-runner
2631

27-
FROM alpine
32+
COPY --from=0 /docker-machine-driver-scaleway/docker-machine-driver-scaleway /usr/local/bin/docker-machine-driver-scaleway-v2
33+
COPY --from=1 /go/src/github.com/docker/machine/docker-machine /usr/local/bin/docker-machine
34+
35+
VOLUME /root/.docker/machine
36+
37+
FROM alpine as docker-machine
2838

2939
RUN apk add --no-cache ca-certificates
3040

@@ -34,3 +44,4 @@ COPY --from=1 /go/src/github.com/docker/machine/docker-machine /usr/local/bin/do
3444
VOLUME /root/.docker/machine
3545

3646
ENTRYPOINT ["docker-machine"]
47+

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ RUNNER_VERSION := v16.9.1
77
docker: docker-build docker-push
88

99
docker-build:
10-
@docker build -t $(DOCKER_MACHINE_IMAGE) .
11-
@docker build -t $(RUNNER_IMAGE):$(RUNNER_VERSION) -f gitlab-runner.Dockerfile .
10+
@docker build --target docker-machine -t $(DOCKER_MACHINE_IMAGE) .
11+
@docker build --target gitlab-runner -t $(RUNNER_IMAGE):$(RUNNER_VERSION) .
1212
docker-push:
1313
@docker push $(DOCKER_MACHINE_IMAGE)
1414
@docker push $(RUNNER_IMAGE):$(RUNNER_VERSION)

gitlab-runner.Dockerfile

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)