diff --git a/README.md b/README.md index 9237074..223c736 100644 --- a/README.md +++ b/README.md @@ -181,10 +181,11 @@ environment is consistent across any `docker` enabled platform. When the docker image builds, the test are run inside the docker container, on failure they will stop the build. -Run the tests with the following command: +Run the tests with the following commands for both `alpine` and `ubuntu` images: ```sh -docker build -t github-release-resource . +docker build -t github-release-resource -f dockerfiles/alpine/Dockerfile . +docker build -t github-release-resource -f dockerfiles/ubuntu/Dockerfile . ``` ### Contributing diff --git a/Dockerfile b/dockerfiles/alpine/Dockerfile similarity index 100% rename from Dockerfile rename to dockerfiles/alpine/Dockerfile diff --git a/dockerfiles/ubuntu/Dockerfile b/dockerfiles/ubuntu/Dockerfile new file mode 100644 index 0000000..6c1006f --- /dev/null +++ b/dockerfiles/ubuntu/Dockerfile @@ -0,0 +1,26 @@ +FROM concourse/golang-builder as builder +COPY . /go/src/github.com/concourse/github-release-resource +ENV CGO_ENABLED 0 +ENV GOPATH /go/src/github.com/concourse/github-release-resource/Godeps/_workspace:${GOPATH} +ENV PATH /go/src/github.com/concourse/github-release-resource/Godeps/_workspace/bin:${PATH} +RUN go build -o /assets/out github.com/concourse/github-release-resource/cmd/out +RUN go build -o /assets/in github.com/concourse/github-release-resource/cmd/in +RUN go build -o /assets/check github.com/concourse/github-release-resource/cmd/check +RUN set -e; for pkg in $(go list ./...); do \ + go test -o "/tests/$(basename $pkg).test" -c $pkg; \ + done + +FROM ubuntu:bionic AS resource +RUN apt-get update && apt-get install -y --no-install-recommends \ + tzdata \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* +COPY --from=builder /assets /opt/resource + +FROM resource AS tests +COPY --from=builder /tests /tests +RUN set -e; for test in /tests/*.test; do \ + $test; \ + done + +FROM resource