-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
45 lines (28 loc) · 1.08 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
# Stage 1: Build the Ant app
FROM golang:1.23.0-bookworm AS builder
ARG TARGETOS=linux
ARG TARGETARCH=amd64
RUN apt-get update -y && \
apt-get install -y --no-install-recommends make rsync openssh-server ssh && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /go/src/github.com/cloud-barista/cm-ant
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH make build
# Stage 2: Run the Ant app
FROM ubuntu:22.04 as prod
RUN apt update && \
apt install -y sudo curl rsync
# ANT ROOT PATH
ENV ANT_ROOT_PATH=/app
WORKDIR $ANT_ROOT_PATH
COPY --from=builder /go/src/github.com/cloud-barista/cm-ant/ant /app/ant
COPY --from=builder /go/src/github.com/cloud-barista/cm-ant/config.yaml /app/config.yaml
COPY --from=builder /go/src/github.com/cloud-barista/cm-ant/test_plan /app/test_plan
COPY --from=builder /go/src/github.com/cloud-barista/cm-ant/script /app/script
HEALTHCHECK --interval=10s --timeout=5s --start-period=10s \
CMD curl -f "http://localhost:8880/ant/api/v1/readyz" || exit 1
EXPOSE 8880
ENTRYPOINT ["./ant"]