-
Notifications
You must be signed in to change notification settings - Fork 9
/
acceptance-tests.Dockerfile
51 lines (33 loc) · 1.25 KB
/
acceptance-tests.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
51
FROM alpine/git:v2.45.2 AS bats
LABEL maintainer="Rea Sand <[email protected]>"
RUN apk add --no-cache bash
RUN mkdir /bats-source
RUN git clone https://github.com/bats-core/bats-core.git --branch v1.2.0 --single-branch /bats-source
WORKDIR /bats-source
RUN ./install.sh /usr/local
WORKDIR /
RUN mkdir /bats-libs
RUN git clone https://github.com/ztombol/bats-support /bats-libs/bats-support
RUN git clone https://github.com/ztombol/bats-assert /bats-libs/bats-assert
# ----------------------------------------------------------------- #
FROM golang:1.23-alpine AS git-team
RUN mkdir /git-team-source
WORKDIR /git-team-source
ENV GOPATH=/go
COPY go.* ./
RUN go mod download
COPY src ./src
COPY main.go .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install ./...
# ----------------------------------------------------------------- #
FROM golang:1.23-alpine
RUN apk add --no-cache bash git ncurses
COPY --from=bats /usr/local/bin/bats /usr/local/bin/bats
COPY --from=bats /usr/local/libexec/bats-core /usr/local/libexec/bats-core
COPY --from=bats /bats-libs /bats-libs
COPY --from=git-team /go/bin/git-team /usr/local/bin/git-team
WORKDIR /
ENV USERNAME=git-team-acceptance-test
RUN adduser -D ${USERNAME}
USER ${USERNAME}
ENTRYPOINT ["bash", "/usr/local/bin/bats"]