-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathDockerfile
42 lines (33 loc) · 1.13 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
ARG ALPINE_VERSION=3.17
ARG GO_VERSION=1.19.6
# build image
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} as build
ARG DOCKERCLI_VERSION=20.10.23
ARG DOCKERCLI_CHANNEL=stable
ARG BUILDTIME
ARG COMMIT
ARG TAG
ARG GOPROXY
RUN apk add --no-cache \
bash \
make \
git \
curl \
util-linux \
coreutils \
build-base
# Fetch docker cli to run a registry container for e2e tests
RUN curl -Ls https://download.docker.com/linux/static/${DOCKERCLI_CHANNEL}/x86_64/docker-${DOCKERCLI_VERSION}.tgz | tar -xz
WORKDIR /go/src/github.com/cnabio/cnab-to-oci
COPY . .
RUN make BUILDTIME=$BUILDTIME COMMIT=$COMMIT TAG=$TAG bin/cnab-to-oci &&\
make BUILDTIME=$BUILDTIME COMMIT=$COMMIT TAG=$TAG build-e2e-test
# e2e image
FROM alpine:${ALPINE_VERSION} as e2e
# copy all the elements needed for e2e tests from build image
COPY --from=build /go/docker/docker /usr/bin/docker
COPY --from=build /go/src/github.com/cnabio/cnab-to-oci/bin/cnab-to-oci /usr/bin/cnab-to-oci
COPY --from=build /go/src/github.com/cnabio/cnab-to-oci/e2e /e2e
COPY --from=build /go/src/github.com/cnabio/cnab-to-oci/e2e.test /e2e/e2e.test
# Run end-to-end tests
CMD ["e2e/run.sh"]