2021-05-14 13:23:04 +00:00
|
|
|
# build stage
|
2024-03-07 22:17:24 +00:00
|
|
|
FROM golang:1.22-alpine AS build-env
|
2021-05-14 13:23:04 +00:00
|
|
|
RUN apk --no-cache add build-base git gcc
|
2021-09-07 04:24:21 +00:00
|
|
|
|
|
|
|
RUN mkdir -p /build
|
2022-02-18 10:55:15 +00:00
|
|
|
COPY ./ /build/
|
2021-09-07 04:24:21 +00:00
|
|
|
|
2023-10-04 20:58:42 +00:00
|
|
|
WORKDIR /build/cmd/ctrl/
|
2021-09-07 04:24:21 +00:00
|
|
|
RUN go version
|
2023-10-04 20:58:42 +00:00
|
|
|
RUN go build -o ctrl
|
2021-05-14 13:23:04 +00:00
|
|
|
|
|
|
|
# final stage
|
|
|
|
FROM alpine
|
2021-09-07 04:24:21 +00:00
|
|
|
|
|
|
|
RUN apk update && apk add curl && apk add nmap
|
|
|
|
|
2021-05-14 13:23:04 +00:00
|
|
|
WORKDIR /app
|
2023-10-04 20:58:42 +00:00
|
|
|
COPY --from=build-env /build/cmd/ctrl/ctrl /app/
|
2021-05-14 13:23:04 +00:00
|
|
|
|
2024-03-27 11:48:17 +00:00
|
|
|
CMD ["ash","-c","/app/ctrl"]
|