mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-23 15:37:01 +00:00
test: Add Dockerfile
This patch adds a Docker configuration file, to build an image that can run the integration and stress tests. It might be used for configuring automated testing infrastructure in subsequent patches.
This commit is contained in:
42
test/Dockerfile
Normal file
42
test/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Docker file for creating a docker container that can run the tests.
|
||||||
|
#
|
||||||
|
# Create the image:
|
||||||
|
# docker build -t chasquid-test -f test/Dockerfile .
|
||||||
|
#
|
||||||
|
# Run the tests:
|
||||||
|
# docker run --rm chasquid-test make test
|
||||||
|
#
|
||||||
|
# Get a shell inside the image (for debugging):
|
||||||
|
# docker run -it --entrypoint=/bin/bash chasquid-test
|
||||||
|
|
||||||
|
FROM golang:latest
|
||||||
|
|
||||||
|
WORKDIR /go/src/blitiri.com.ar/go/chasquid
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Make debconf/frontend non-interactive, to avoid distracting output about the
|
||||||
|
# lack of $TERM.
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
|
# Install the basics for the integration tests.
|
||||||
|
RUN apt-get update -q
|
||||||
|
RUN apt-get install -y -q python3 msmtp
|
||||||
|
|
||||||
|
# Packages for the (optional) dovecot integration test.
|
||||||
|
RUN apt-get install -y -q gettext-base dovecot-imapd
|
||||||
|
|
||||||
|
# Packages for the (optional) exim integration test.
|
||||||
|
RUN apt-get install -y -q exim4-daemon-light
|
||||||
|
RUN cd test/t-02-exim && mkdir -p .exim4 && ln -s /usr/sbin/exim4 .exim4/
|
||||||
|
|
||||||
|
RUN go get -d ./...
|
||||||
|
RUN go install ./...
|
||||||
|
|
||||||
|
# Don't run the tests as root: it makes some integration tests more difficult,
|
||||||
|
# as for example Exim has hard-coded protections against running as root.
|
||||||
|
RUN useradd -m chasquid
|
||||||
|
RUN chown -R chasquid:chasquid .
|
||||||
|
USER chasquid
|
||||||
|
|
||||||
|
# Tests expect the $USER variable set.
|
||||||
|
ENV USER chasquid
|
||||||
Reference in New Issue
Block a user