Skip to content

Commit

Permalink
Merge pull request #58 from concourse/image-args
Browse files Browse the repository at this point in the history
use alpine:latest and ubuntu:latest as base
  • Loading branch information
vito authored Jan 14, 2021
2 parents 13ce58f + f42e2fa commit 10873d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 9 additions & 6 deletions dockerfiles/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM golang:alpine as builder
ARG base_image=alpine:latest
ARG builder_image=concourse/golang-builder

FROM ${builder_image} as builder
COPY . /go/src/github.com/concourse/pool-resource
ENV CGO_ENABLED 0
ENV GOPATH /go/src/github.com/concourse/pool-resource/Godeps/_workspace:${GOPATH}
Expand All @@ -8,20 +11,20 @@ RUN set -e; for pkg in $(go list ./...); do \
go test -o "/tests/$(basename $pkg).test" -c $pkg; \
done

FROM concourse/git-resource:alpine AS resource

FROM ${base_image} AS resource
RUN apk add --no-cache bash jq git git-daemon
RUN git config --global user.email "git@localhost"
RUN git config --global user.name "git"
ADD assets/ /opt/resource/
RUN chmod +x /opt/resource/*

COPY --from=builder /assets /opt/go
RUN chmod +x /opt/go/out

FROM resource AS tests
COPY --from=builder /tests /go/resource-tests/
RUN set -e; for test in /go/resource-tests/*.test; do \
$test; \
$test -ginkgo.v; \
done

ADD test/ /opt/resource-tests
RUN /opt/resource-tests/all.sh

Expand Down
12 changes: 8 additions & 4 deletions dockerfiles/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM concourse/golang-builder as builder
ARG base_image
ARG builder_image=concourse/golang-builder

FROM ${builder_image} as builder
COPY . /go/src/github.com/concourse/pool-resource
ENV CGO_ENABLED 0
ENV GOPATH /go/src/github.com/concourse/pool-resource/Godeps/_workspace:${GOPATH}
Expand All @@ -8,11 +11,13 @@ RUN set -e; for pkg in $(go list ./...); do \
go test -o "/tests/$(basename $pkg).test" -c $pkg; \
done

FROM concourse/git-resource:ubuntu AS resource
FROM ${base_image} AS resource
RUN apt-get update && apt-get install -y jq git
RUN git config --global user.email "git@localhost"
RUN git config --global user.name "git"

ADD assets/ /opt/resource/
RUN chmod +x /opt/resource/*

COPY --from=builder /assets /opt/go
RUN chmod +x /opt/go/out

Expand All @@ -21,7 +26,6 @@ COPY --from=builder /tests /go/resource-tests/
RUN set -e; for test in /go/resource-tests/*.test; do \
$test; \
done

ADD test/ /opt/resource-tests
RUN /opt/resource-tests/all.sh

Expand Down

0 comments on commit 10873d1

Please sign in to comment.