forked from ghostunnel/ghostunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile-test
More file actions
46 lines (35 loc) · 1.65 KB
/
Dockerfile-test
File metadata and controls
46 lines (35 loc) · 1.65 KB
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
43
44
45
46
# Dockerfile for running integration tests, includes PKCS11/SoftHSM setup.
#
# Build image:
# docker buildx build -t ghostunnel/ghostunnel-test -f Dockerfile-test .
#
# Run integration tests:
# docker run -v /dev/log:/dev/log -v $PWD:/go/src/github.com/ghostunnel/ghostunnel ghostunnel/ghostunnel-test
FROM golang:latest
# Install build dependencies
RUN apt-get update && \
apt-get install -y build-essential python3-minimal netcat-traditional softhsm2 rsyslog git openssl default-jre-headless </dev/null && \
mkdir -p /etc/softhsm /var/lib/softhsm/tokens /go/src/github.com/ghostunnel/ghostunnel && \
go install golang.org/x/tools/cmd/cover@latest && \
go install github.com/magefile/mage@latest
WORKDIR /go/src/github.com/ghostunnel/ghostunnel
# Mark workspace as safe for git — the volume mount at runtime may have
# different ownership than the container user, which causes git (and
# therefore go build with VCS stamping) to fail.
RUN git config --global --add safe.directory /go/src/github.com/ghostunnel/ghostunnel
ENV GO111MODULE=on
# Copy source code
COPY . /go/src/github.com/ghostunnel/ghostunnel
# Setup SoftHSM for testing PKCS11 support
# Instruct PKCS11 integration test to run
ENV GHOSTUNNEL_TEST_PKCS11=true
# Set params for PKCS11 module
ENV GHOSTUNNEL_TEST_PKCS11_MODULE=/usr/lib/softhsm/libsofthsm2.so
ENV GHOSTUNNEL_TEST_PKCS11_LABEL=ghostunnel-pkcs11-test
ENV GHOSTUNNEL_TEST_PKCS11_PIN=1234
# Set SoftHSM config file
ENV SOFTHSM2_CONF=/etc/softhsm/softhsm2.conf
# Add GOPATH/bin to PATH for mage (default GOPATH in golang images is /go)
ENV PATH=$PATH:/go/bin
ENTRYPOINT ["mage"]
CMD ["-v", "test:softhsmimport", "test:all"]