-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,41 @@ | ||
FROM alpine:3.16.2 | ||
RUN apk update && apk add ca-certificates && apk add bash && rm -rf /var/cache/apk/* | ||
FROM golang:1.18.5-alpine3.16 as builder | ||
|
||
RUN addgroup -S -g 1000 radix && adduser -S -u 1000 -G radix radix | ||
ENV GO111MODULE=on | ||
|
||
RUN apk update && \ | ||
apk add bash jq alpine-sdk sed gawk git ca-certificates curl mc && \ | ||
apk add --no-cache gcc musl-dev | ||
RUN go install honnef.co/go/tools/cmd/[email protected] && \ | ||
go install github.com/rakyll/[email protected] && \ | ||
go install github.com/golang/mock/[email protected] && \ | ||
go install github.com/go-swagger/go-swagger/cmd/[email protected] | ||
|
||
WORKDIR /app | ||
COPY rx /app/rx | ||
|
||
# Install project dependencies | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
# Copy project code | ||
COPY . /app | ||
|
||
# lint and unit tests | ||
RUN staticcheck ./... && \ | ||
go vet ./... && \ | ||
CGO_ENABLED=0 GOOS=linux go test ./... | ||
|
||
RUN addgroup -S -g 1000 radix && adduser -S -u 1000 -G radix radix | ||
|
||
# Build | ||
RUN swagger generate client -t ./generated-client -f https://api.radix.equinor.com/swaggerui/swagger.json -A radixapi && \ | ||
go mod tidy && \ | ||
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o ./rootfs/rx | ||
|
||
## Run operator | ||
FROM scratch | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=builder /etc/passwd /etc/passwd | ||
COPY --from=builder /app/rootfs/rx /usr/local/bin/rx | ||
USER 1000 | ||
ENTRYPOINT ["/app/rx"] | ||
ENTRYPOINT ["/usr/local/bin/rx"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM alpine:3.16.2 | ||
RUN apk update && apk add ca-certificates && apk add bash && rm -rf /var/cache/apk/* | ||
|
||
RUN addgroup -S -g 1000 radix && adduser -S -u 1000 -G radix radix | ||
|
||
WORKDIR /app | ||
COPY rx /app/rx | ||
USER 1000 | ||
ENTRYPOINT ["/app/rx"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters