-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathDockerfile
30 lines (20 loc) · 886 Bytes
/
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
FROM golang:1.23@sha256:927112936d6b496ed95f55f362cc09da6e3e624ef868814c56d55bd7323e0959 AS operator_builder
ARG GO_LDFLAGS=""
ARG BUILD_TIME
ARG CGO_ENABLED=0
ARG GOOS=linux
ARG GOARCH=amd64
WORKDIR /operator
COPY . ./
RUN go mod download
RUN GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=$CGO_ENABLED GO_LDFLAGS=$GO_LDFLAGS \
go build -o slurm_operator ./cmd/
#######################################################################################################################
FROM alpine:latest@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c AS slurm-operator
COPY --from=operator_builder /operator/slurm_operator /usr/bin/
RUN addgroup -S -g 1001 operator && \
adduser -S -u 1001 operator -G operator operator && \
chown 1001:1001 /usr/bin/slurm_operator && \
chmod 500 /usr/bin/slurm_operator
USER 1001
CMD ["/usr/bin/slurm_operator"]