-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
50 lines (43 loc) · 1.26 KB
/
Dockerfile
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
47
48
49
50
ARG base_image=ubuntu:latest
ARG builder_image=concourse/golang-builder
FROM ${builder_image} as builder
WORKDIR /src
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
ENV CGO_ENABLED 0
RUN go build -o /assets/hgresource ./hgresource
RUN set -e; for pkg in $(go list ./...); do \
go test -o "/tests/$(basename $pkg).test" -c $pkg; \
done
FROM ${base_image} AS resource
USER root
RUN apt update && apt upgrade -y -o Dpkg::Options::="--force-confdef"
RUN apt update && apt install -y --no-install-recommends \
curl \
ca-certificates \
gnupg \
jq \
openssh-client \
python3 \
python3-pip \
build-essential \
python3-all-dev \
python3-setuptools \
python3-wheel
RUN pip3 install mercurial hg-evolve
RUN apt remove -y python3-wheel python3-setuptools \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /assets /opt/resource
RUN chmod +x /opt/resource/*
RUN ln -s /opt/resource/hgresource /opt/resource/in; ln -s /opt/resource/hgresource /opt/resource/out; ln -s /opt/resource/hgresource /opt/resource/check
ADD hgrc /etc/mercurial/hgrc
FROM resource AS tests
COPY --from=builder /tests /go-tests
RUN set -e; for test in /go-tests/*.test; do \
$test; \
done
COPY /test /test
RUN /test/all.sh
FROM resource