-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathDockerfile
43 lines (32 loc) · 1.19 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
FROM --platform=$BUILDPLATFORM golang:1.22-alpine as rita-builder
ARG TARGETOS
ARG TARGETARCH
# install dependencies
RUN apk add --no-cache git make ca-certificates wget build-base
# set the working directory
WORKDIR /go/src/github.com/activecm/rita
# cache dependencies
COPY go.mod go.sum ./
RUN go mod download
# copy the rest of the code
COPY . ./
# Change ARGs with --build-arg to target other architectures
# Produce a self-contained statically linked binary
ARG CGO_ENABLED=0
# Set the build target architecture and OS
ARG GOARCH=${TARGETARCH}
ARG GOOS=${TARGETOS}
# Passing arguments in to make result in them being set as
# environment variables for the call to go build
RUN make CGO_ENABLED=$CGO_ENABLED GOARCH=$GOARCH GOOS=$GOOS
# RUN mkdir /var/log/rita
# RUN chmod 0755 /var/log/rita
FROM alpine
# RUN mkdir /logs
# RUN chmod 0755 /logs
WORKDIR /
# COPY --from=rita-builder /go/src/github.com/activecm/rita/config.hjson /etc/rita/config.hjson
COPY --from=rita-builder /go/src/github.com/activecm/rita/rita /rita
# COPY --from=rita-builder /go/src/github.com/activecm/rita/.env.production /.env
# COPY --from=rita-builder /go/src/github.com/activecm/rita/deployment /etc/rita
ENTRYPOINT ["/rita"]