Skip to content

Commit

Permalink
Merge pull request #256 from concourse/bionic-base-image
Browse files Browse the repository at this point in the history
switch to ubuntu:bionic for base image
  • Loading branch information
cirocosta authored Mar 26, 2019
2 parents fd49234 + 36b38c8 commit 9bb78ff
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,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.

Build the image and run the tests with the following command:
Run the tests with the following commands for both `alpine` and `ubuntu` images:

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

To use the newly built image, push it to a docker registry that's accessible to
Expand Down
2 changes: 1 addition & 1 deletion assets/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ start_docker() {
declare -fx try_start
trap stop_docker EXIT

if ! timeout -t ${STARTUP_TIMEOUT} bash -ce 'while true; do try_start && break; done'; then
if ! timeout ${STARTUP_TIMEOUT} bash -ce 'while true; do try_start && break; done'; then
echo Docker failed to start within ${STARTUP_TIMEOUT} seconds.
return 1
fi
Expand Down
File renamed without changes.
53 changes: 53 additions & 0 deletions dockerfiles/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# stage: builder
FROM concourse/golang-builder AS builder

COPY . /go/src/github.com/concourse/docker-image-resource
ENV CGO_ENABLED 0
COPY assets/ /assets
RUN go build -o /assets/check github.com/concourse/docker-image-resource/cmd/check
RUN go build -o /assets/print-metadata github.com/concourse/docker-image-resource/cmd/print-metadata
RUN go build -o /assets/ecr-login github.com/concourse/docker-image-resource/vendor/github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cmd
RUN set -e; \
for pkg in $(go list ./...); do \
go test -o "/tests/$(basename $pkg).test" -c $pkg; \
done

# stage: resource
FROM ubuntu:bionic AS resource

# docker hosts their own packages, this steps sets up the repo for apt-get
RUN apt-get update; \
apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common; \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - ; \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable";

RUN apt-get update && apt-get install -y --no-install-recommends \
docker-ce \
jq \
ca-certificates \
xz-utils \
iproute2 \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /assets /opt/resource
RUN ln -s /opt/resource/ecr-login /usr/local/bin/docker-credential-ecr-login

# stage: tests
FROM resource AS tests
COPY --from=builder /tests /tests
ADD . /docker-image-resource
RUN set -e; \
for test in /tests/*.test; do \
$test -ginkgo.v; \
done

# final output stage
FROM resource

0 comments on commit 9bb78ff

Please sign in to comment.