Skip to content

Commit

Permalink
Based docker build on alpine:edge image and included tests for the build
Browse files Browse the repository at this point in the history
in the Dockerfile.
Updated README.md to include developer and testing instructions.
Removed old files and scripts for building and testing.

Signed-off-by: Joris Melchior <jmelchior@pivotal.io>
  • Loading branch information
JT Archie authored and jmelchio committed Sep 20, 2017
1 parent b7312f6 commit 6c24c8c
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 65 deletions.
26 changes: 22 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
FROM concourse/buildroot:base
FROM golang:alpine 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

ADD assets/check /opt/resource/check
ADD assets/in /opt/resource/in
ADD assets/out /opt/resource/out
FROM alpine:edge AS resource
RUN apk add --update bash tzdata
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
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,31 @@ prepended with this string. This is useful for adding v in front of version numb

* `globs`: *Optional.* A list of globs for files that will be uploaded alongside
the created release.

## Development

### Prerequisites

* golang is *required* - version 1.9.x is tested; earlier versions may also
work.
* docker is *required* - version 17.06.x is tested; earlier versions may also
work.
* godep is used for dependency management of the golang packages.

### Running the tests

The tests have been embedded with the `Dockerfile`; ensuring that the testing
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:

```sh
docker build -t github-release-resource .
```

### Contributing

Please make all pull requests to the `master` branch and ensure tests pass
locally.
16 changes: 0 additions & 16 deletions build.yml

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/build

This file was deleted.

19 changes: 0 additions & 19 deletions scripts/ci

This file was deleted.

18 changes: 0 additions & 18 deletions scripts/test

This file was deleted.

0 comments on commit 6c24c8c

Please sign in to comment.