-
Notifications
You must be signed in to change notification settings - Fork 86
/
test.Dockerfile
44 lines (30 loc) · 1.03 KB
/
test.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
FROM alpine:latest AS backend
RUN apk update
RUN apk upgrade
RUN apk add --update bash cmake g++ gcc git make vips-dev
COPY --from=golang:1.23-alpine /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"
# Declare an ARG for the branch name with a default value of "main"
ARG BRANCH_NAME=main
WORKDIR /deso/src
RUN git clone https://github.com/deso-protocol/core.git
WORKDIR /deso/src/core
RUN git pull
# Try to checkout to the specified branch. If it fails, checkout main.
RUN git checkout ${BRANCH_NAME} || (echo "Branch ${BRANCH_NAME} not found. Falling back to main." && git checkout main)
RUN go mod download
WORKDIR /deso/src/backend
COPY go.mod .
COPY go.sum .
RUN go mod download
# include backend src
COPY apis apis
COPY cmd cmd
COPY miner miner
COPY routes routes
COPY countries countries
COPY config config
COPY main.go .
# build backend
RUN GOOS=linux go build -mod=mod -a -installsuffix cgo -o bin/backend main.go
ENTRYPOINT ["go", "test", "-v", "github.com/deso-protocol/backend/routes"]