diff --git a/dockerfiles/alpine/Dockerfile b/dockerfiles/alpine/Dockerfile index f1bc700..3dbf33d 100644 --- a/dockerfiles/alpine/Dockerfile +++ b/dockerfiles/alpine/Dockerfile @@ -1,4 +1,7 @@ -FROM golang:1 as builder +ARG base_image=alpine:latest +ARG builder_image=concourse/golang-builder + +FROM ${builder_image} as builder WORKDIR /src COPY go.mod . @@ -12,7 +15,7 @@ RUN set -e; for pkg in $(go list ./...); do \ go test -o "/tests/$(basename $pkg).test" -c $pkg; \ done -FROM alpine:edge AS resource +FROM ${base_image} AS resource RUN apk add --update \ bash \ curl \ diff --git a/dockerfiles/ubuntu/Dockerfile b/dockerfiles/ubuntu/Dockerfile index 4e02593..97dff9e 100644 --- a/dockerfiles/ubuntu/Dockerfile +++ b/dockerfiles/ubuntu/Dockerfile @@ -1,10 +1,11 @@ -FROM concourse/golang-builder as builder -WORKDIR /src +ARG base_image +ARG builder_image=concourse/golang-builder +FROM ${builder_image} as builder +WORKDIR /src COPY go.mod . COPY go.sum . RUN go mod download - COPY . . ENV CGO_ENABLED 0 RUN go build -o /assets/hgresource ./hgresource @@ -12,22 +13,22 @@ RUN set -e; for pkg in $(go list ./...); do \ go test -o "/tests/$(basename $pkg).test" -c $pkg; \ done -FROM ubuntu:bionic AS resource +FROM ${base_image} AS resource RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ gnupg \ jq \ openssh-client \ - python \ - python-pip \ + python3 \ + python3-pip \ build-essential \ - python-all-dev \ - python-setuptools \ - python-wheel \ + python3-all-dev \ + python3-setuptools \ + python3-wheel \ && rm -rf /var/lib/apt/lists/* \ - && pip2 install mercurial \ - && pip2 install hg-evolve + && pip3 install mercurial \ + && pip3 install hg-evolve COPY --from=builder /assets /opt/resource RUN chmod +x /opt/resource/*