Dockerfile.e2e 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ARG GO_VERSION=1.17.5
  2. FROM golang:${GO_VERSION}-alpine AS base
  3. ENV GO111MODULE=off
  4. RUN apk --no-cache add \
  5. bash \
  6. btrfs-progs-dev \
  7. build-base \
  8. curl \
  9. lvm2-dev \
  10. jq
  11. RUN mkdir -p /build/
  12. RUN mkdir -p /go/src/github.com/docker/docker/
  13. WORKDIR /go/src/github.com/docker/docker/
  14. FROM base AS frozen-images
  15. # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
  16. COPY contrib/download-frozen-image-v2.sh /
  17. RUN /download-frozen-image-v2.sh /build \
  18. busybox:latest@sha256:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209 \
  19. busybox:latest@sha256:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209 \
  20. debian:bullseye-slim@sha256:dacf278785a4daa9de07596ec739dbc07131e189942772210709c5c0777e8437 \
  21. hello-world:latest@sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9 \
  22. arm32v7/hello-world:latest@sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1
  23. # See also frozenImages in "testutil/environment/protect.go" (which needs to be updated when adding images to this list)
  24. FROM base AS dockercli
  25. ENV INSTALL_BINARY_NAME=dockercli
  26. COPY hack/dockerfile/install/install.sh ./install.sh
  27. COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
  28. RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME
  29. # Build DockerSuite.TestBuild* dependency
  30. FROM base AS contrib
  31. COPY contrib/syscall-test /build/syscall-test
  32. COPY contrib/httpserver/Dockerfile /build/httpserver/Dockerfile
  33. COPY contrib/httpserver contrib/httpserver
  34. RUN CGO_ENABLED=0 go build -buildmode=pie -o /build/httpserver/httpserver github.com/docker/docker/contrib/httpserver
  35. # Build the integration tests and copy the resulting binaries to /build/tests
  36. FROM base AS builder
  37. # Set tag and add sources
  38. COPY . .
  39. # Copy test sources tests that use assert can print errors
  40. RUN mkdir -p /build${PWD} && find integration integration-cli -name \*_test.go -exec cp --parents '{}' /build${PWD} \;
  41. # Build and install test binaries
  42. ARG DOCKER_GITCOMMIT=undefined
  43. RUN hack/make.sh build-integration-test-binary
  44. RUN mkdir -p /build/tests && find . -name test.main -exec cp --parents '{}' /build/tests \;
  45. ## Generate testing image
  46. FROM alpine:3.10 as runner
  47. ENV DOCKER_REMOTE_DAEMON=1
  48. ENV DOCKER_INTEGRATION_DAEMON_DEST=/
  49. ENTRYPOINT ["/scripts/run.sh"]
  50. # Add an unprivileged user to be used for tests which need it
  51. RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash
  52. # GNU tar is used for generating the emptyfs image
  53. RUN apk --no-cache add \
  54. bash \
  55. ca-certificates \
  56. g++ \
  57. git \
  58. inetutils-ping \
  59. iptables \
  60. libcap2-bin \
  61. pigz \
  62. tar \
  63. xz
  64. COPY hack/test/e2e-run.sh /scripts/run.sh
  65. COPY hack/make/.ensure-emptyfs /scripts/ensure-emptyfs.sh
  66. COPY integration/testdata /tests/integration/testdata
  67. COPY integration/build/testdata /tests/integration/build/testdata
  68. COPY integration-cli/fixtures /tests/integration-cli/fixtures
  69. COPY --from=frozen-images /build/ /docker-frozen-images
  70. COPY --from=dockercli /build/ /usr/bin/
  71. COPY --from=contrib /build/ /tests/contrib/
  72. COPY --from=builder /build/ /