| 1 |
# Docker file for creating a docker container that can run the tests. |
| 2 |
# |
| 3 |
# Create the image: |
| 4 |
# docker build -t dnss-test -f tests/Dockerfile . |
| 5 |
# |
| 6 |
# Run the tests: |
| 7 |
# docker run --rm dnss-test |
| 8 |
# |
| 9 |
# Get a shell inside the image (for debugging): |
| 10 |
# docker run -it --entrypoint=/bin/bash dnss-test |
| 11 |
|
| 12 |
FROM golang:latest |
| 13 |
|
| 14 |
WORKDIR /go/src/blitiri.com.ar/go/dnss |
| 15 |
|
| 16 |
# Make debconf/frontend non-interactive, to avoid distracting output about the |
| 17 |
# lack of $TERM. |
| 18 |
ENV DEBIAN_FRONTEND noninteractive |
| 19 |
|
| 20 |
RUN apt-get update -q |
| 21 |
|
| 22 |
# Install the required packages for the integration tests. |
| 23 |
RUN apt-get install -y -q knot-dnsutils systemd |
| 24 |
|
| 25 |
# Copy into the container. Everything below this line will not be cached. |
| 26 |
COPY . . |
| 27 |
|
| 28 |
# Update dependencies to the latest versions, and fetch them to the cache. |
| 29 |
# Fetch dependencies to the cache, because we might not have external network |
| 30 |
# access once we are running. |
| 31 |
# $GO_GET_ARGS allows to create a variant that updates the dependencies to the |
| 32 |
# latest versions, for testing. |
| 33 |
RUN go get -d -v ${GO_GET_ARGS} ./... && go mod download |
| 34 |
|
| 35 |
# Install dnss, to make sure it is ready to be tested. |
| 36 |
RUN go get -d -v . && go install -v . |
| 37 |
|
| 38 |
# Run all the tests. |
| 39 |
CMD tests/all.sh |