-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yee Hing Tong <[email protected]>
- Loading branch information
1 parent
d586b44
commit 4afbd5c
Showing
4 changed files
with
52 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM --platform=${BUILDPLATFORM} golang:1.19-alpine3.16 as builder | ||
|
||
ARG TARGETARCH | ||
ENV GOARCH "${TARGETARCH}" | ||
ENV GOOS linux | ||
|
||
RUN apk add git openssh-client make curl | ||
|
||
# Create the artifacts directory | ||
RUN mkdir /artifacts | ||
|
||
|
||
# COPY only the go mod files for efficient caching | ||
COPY go.mod go.sum /go/src/github.com/flyteorg/flyte/flyteartifacts/ | ||
WORKDIR /go/src/github.com/flyteorg/flyte/flyteartifacts/ | ||
|
||
|
||
# Pull dependencies | ||
RUN go mod download | ||
|
||
# COPY the rest of the source code | ||
COPY . /go/src/github.com/flyteorg/flyte/flyteartifacts/ | ||
|
||
# This 'linux_compile' target should compile binaries to the /artifacts directory | ||
# The main entrypoint should be compiled to /artifacts/flyteadmin | ||
RUN make linux_compile | ||
|
||
# update the PATH to include the /artifacts directory | ||
ENV PATH="/artifacts:${PATH}" | ||
|
||
# This will eventually move to centurylink/ca-certs:latest for minimum possible image size | ||
FROM alpine:3.16 | ||
LABEL org.opencontainers.image.source https://github.com/flyteorg/flyte/ | ||
|
||
COPY --from=builder /artifacts /bin | ||
|
||
# Ensure the latest CA certs are present to authenticate SSL connections. | ||
RUN apk --update add ca-certificates | ||
|
||
RUN addgroup -S flyte && adduser -S flyte -G flyte | ||
USER flyte | ||
|
||
CMD ["artifacts"] |
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,6 @@ | ||
|
||
.PHONY: linux_compile | ||
linux_compile: export CGO_ENABLED ?= 0 | ||
linux_compile: export GOOS ?= linux | ||
linux_compile: | ||
go build -o /artifacts/flyteadmin -ldflags=$(LD_FLAGS) ./cmd/ |
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