Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from concourse/bionic-base-image
Browse files Browse the repository at this point in the history
Migrating to ubuntu:bionic and golang-builder
  • Loading branch information
cirocosta authored Mar 26, 2019
2 parents d8a193b + fdbb9be commit 9179cfe
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,32 @@ You'll need a separate resource for each Tracker project.
* `repos`: *Required.* Paths to the git repositories which will contain the delivering commits.

* `comment`: *Optional.* A file containing a comment to leave on any delivered stories.

## 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 commands for both `alpine` and `ubuntu` images:

```sh
docker build -t tracker-resource -f dockerfiles/alpine/Dockerfile .
docker build -t tracker-resource -f dockerfiles/ubuntu/Dockerfile .
```

### Contributing

Please make all pull requests to the `master` branch and ensure tests pass
locally.
File renamed without changes.
31 changes: 31 additions & 0 deletions dockerfiles/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM concourse/golang-builder as builder
COPY . /go/src/github.com/concourse/tracker-resource
ENV CGO_ENABLED 0
ENV GOPATH /go/src/github.com/concourse/tracker-resource/Godeps/_workspace:${GOPATH}
ENV PATH /go/src/github.com/concourse/tracker-resource/Godeps/_workspace/bin:${PATH}
RUN go build -o /assets/out github.com/concourse/tracker-resource/out/cmd/out
RUN go build -o /assets/in github.com/concourse/tracker-resource/in/cmd/in
RUN go build -o /assets/check github.com/concourse/tracker-resource/check/cmd/check
RUN set -e; mkdir /tests; for pkg in $(go list ./...); do \
cp -a $(go list -f '{{.Dir}}' $pkg) /tests/$(basename $pkg); \
go test -o "/tests/$(basename $pkg)/run" -c $pkg; \
done

FROM ubuntu:bionic AS resource
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
tzdata \
ca-certificates \
git \
&& 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/*/run; do \
cd $(dirname $test); \
./run; \
done

FROM resource

0 comments on commit 9179cfe

Please sign in to comment.