Dockerfile 741 B

1234567891011121314151617181920212223242526272829
  1. FROM golang:1 as builder
  2. COPY . /src
  3. WORKDIR /src
  4. ENV CGO_ENABLED 0
  5. RUN go get -d ./...
  6. RUN go build -o /assets/in ./cmd/in
  7. RUN go build -o /assets/out ./cmd/out
  8. RUN go build -o /assets/check ./cmd/check
  9. RUN set -e; for pkg in $(go list ./...); do \
  10. go test -o "/tests/$(basename $pkg).test" -c $pkg; \
  11. done
  12. FROM alpine:edge AS resource
  13. RUN apk add --no-cache bash tzdata ca-certificates unzip zip gzip tar
  14. COPY --from=builder assets/ /opt/resource/
  15. RUN chmod +x /opt/resource/*
  16. FROM resource AS tests
  17. COPY --from=builder /tests /tests
  18. ADD . /docker-image-resource
  19. ARG DOCKER_USERNAME
  20. ARG DOCKER_PASSWORD
  21. ARG DOCKER_PRIVATE_REPO
  22. ARG DOCKER_PUSH_REPO
  23. RUN set -e; for test in /tests/*.test; do \
  24. $test -ginkgo.v; \
  25. done
  26. FROM resource