forked from trichner/berryhunter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.berryhunterd
48 lines (35 loc) · 1.13 KB
/
Dockerfile.berryhunterd
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
FROM golang:1.21 AS go_builder
ENV GO111MODULE=on
ENV GOPATH=/go
WORKDIR /go/src/github.com/trichner/berryhunter/
COPY chieftaind/ chieftaind/
COPY berryhunterd/ berryhunterd/
COPY common/ common/
COPY api/ api/
# build common dependency
WORKDIR /go/src/github.com/trichner/berryhunter/common/fbutil/
RUN go get -d -v
RUN CGO_ENABLED=0 GOOS=linux go build -a .
# build chieftain dependency
WORKDIR /go/src/github.com/trichner/berryhunter/chieftaind/
RUN go get -d -v
RUN CGO_ENABLED=0 GOOS=linux go build -a -o chieftaind .
# build binary
WORKDIR /go/src/github.com/trichner/berryhunter/berryhunterd/
RUN go get -d -v
RUN CGO_ENABLED=0 GOOS=linux go build -a -o berryhunterd .
# ---- actual image
FROM alpine:latest
ARG CONF=berryhunterd/conf.docker.json
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
WORKDIR /root/
# copy api definitions
COPY api/items/ api/items/
COPY api/mobs/ api/mobs/
# copy backend together
WORKDIR /root/berryhunterd
COPY berryhunterd/docker-start.sh start.sh
COPY --from=go_builder /go/src/github.com/trichner/berryhunter/berryhunterd/berryhunterd .
COPY $CONF conf.json
EXPOSE 80
CMD ["./start.sh"]