-
Notifications
You must be signed in to change notification settings - Fork 42
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
133 changed files
with
3,998 additions
and
5,046 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
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,19 +1,55 @@ | ||
FROM alpine | ||
# xx is helper for cross-compilation | ||
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.3.0 AS xx | ||
|
||
FROM --platform=$BUILDPLATFORM golang:1.20-alpine3.18 AS builder | ||
RUN apk add build-base | ||
COPY . /usr/src/myapp | ||
WORKDIR /usr/src/myapp | ||
COPY --link --from=xx / / | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ENV CGO_ENABLED=1 | ||
|
||
RUN apk add clang lld | ||
RUN make vendor | ||
RUN xx-go --wrap | ||
RUN xx-apk add musl-dev gcc | ||
RUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-alpine-linux-musl; fi && \ | ||
go build --tags 'sqlite_json' -mod=vendor -ldflags '-s -w -linkmode external -extldflags "-static"' -o bin/tornjak-backend ./cmd/agent/main.go | ||
|
||
FROM alpine AS runtime | ||
RUN mkdir -p /opt/spire | ||
|
||
WORKDIR /opt/spire | ||
ENTRYPOINT ["/opt/spire/run_backend.sh"] | ||
|
||
# Add init | ||
COPY run_backend.sh run_backend.sh | ||
COPY bin/tornjak-backend tornjak-backend | ||
COPY scripts/run_backend.sh run_backend.sh | ||
COPY --from=builder /usr/src/myapp/bin/tornjak-backend tornjak-backend | ||
|
||
# add a version link to the image description | ||
ARG version | ||
ARG github_sha | ||
LABEL org.opencontainers.image.description="Tornjak backend ($version): https://github.com/spiffe/tornjak/releases/tag/$version" \ | ||
LABEL org.opencontainers.image.description="Tornjak backend ($version) Alpine based image: https://github.com/spiffe/tornjak/releases/tag/$version" \ | ||
org.opencontainers.image.source="https://github.com/spiffe/tornjak" \ | ||
org.opencontainers.image.documentation="https://github.com/spiffe/tornjak/tree/main/docs" | ||
org.opencontainers.image.documentation="https://github.com/spiffe/tornjak/tree/main/docs" | ||
|
||
# Additional labels | ||
LABEL architecture="amd64" \ | ||
build-date="" \ | ||
description="Tornjak Backend" \ | ||
io.k8s.description="Tornjak Backend" \ | ||
io.k8s.display-name="tornjak-backend" \ | ||
maintainer="" \ | ||
name="spiffe/tornjak-backend" \ | ||
release="$version" \ | ||
summary="Tornjak backend image" \ | ||
url="" \ | ||
vcs-ref="" \ | ||
vcs-type="" \ | ||
vendor="" \ | ||
version="$version" | ||
|
||
# create env. variables with the build details | ||
ENV VERSION=$version | ||
ENV GITHUB_SHA=$github_sha |
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,54 @@ | ||
# xx is helper for cross-compilation | ||
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.3.0 AS xx | ||
|
||
FROM --platform=$BUILDPLATFORM golang:1.20-alpine3.18 AS builder | ||
RUN apk add build-base | ||
COPY . /usr/src/myapp | ||
WORKDIR /usr/src/myapp | ||
COPY --link --from=xx / / | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ENV CGO_ENABLED=1 | ||
|
||
RUN apk add clang lld | ||
RUN make vendor | ||
RUN xx-go --wrap | ||
RUN xx-apk add musl-dev gcc | ||
RUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-alpine-linux-musl; fi && \ | ||
go build --tags 'sqlite_json' -mod=vendor -ldflags '-s -w -linkmode external -extldflags "-static"' -o bin/tornjak-backend ./cmd/agent/main.go | ||
|
||
FROM registry.access.redhat.com/ubi8-micro:latest AS runtime | ||
RUN mkdir -p /opt/spire | ||
|
||
WORKDIR /opt/spire | ||
ENTRYPOINT ["/opt/spire/run_backend.sh"] | ||
|
||
# Add init | ||
COPY scripts/run_backend.sh run_backend.sh | ||
COPY --from=builder /usr/src/myapp/bin/tornjak-backend tornjak-backend | ||
|
||
# add a version link to the image description | ||
ARG version | ||
ARG github_sha | ||
LABEL org.opencontainers.image.description="Tornjak backend ($version) UBI based image: https://github.com/spiffe/tornjak/releases/tag/$version" \ | ||
org.opencontainers.image.source="https://github.com/spiffe/tornjak" \ | ||
org.opencontainers.image.documentation="https://github.com/spiffe/tornjak/tree/main/docs" | ||
# replace UBI labels | ||
LABEL architecture="amd64" \ | ||
build-date="" \ | ||
description="Tornjak Backend" \ | ||
io.k8s.description="Tornjak Backend" \ | ||
io.k8s.display-name="tornjak-backend" \ | ||
maintainer="" \ | ||
name="spiffe/tornjak-backend" \ | ||
release="$version" \ | ||
summary="Tornjak backend UBI image" \ | ||
url="" \ | ||
vcs-ref="" \ | ||
vcs-type="" \ | ||
vendor="" \ | ||
version="$version" | ||
|
||
# create env. variables with the build details | ||
ENV VERSION=$version | ||
ENV GITHUB_SHA=$github_sha |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.