-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
084cb6b
commit 898eb6b
Showing
35 changed files
with
378 additions
and
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,38 @@ | ||
# Crafted with ❤ at Breu, Inc. <[email protected]>, Copyright © 2022, 2024. | ||
# | ||
# Functional Source License, Version 1.1, Apache 2.0 Future License | ||
# | ||
# We hereby irrevocably grant you an additional license to use the Software under the Apache License, Version 2.0 that | ||
# is effective on the second anniversary of the date we make the Software available. On or after that date, you may use | ||
# the Software under the Apache License, Version 2.0, in which case the following will apply: | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
# the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations under the License. | ||
FROM cgr.dev/chainguard/wolfi-base AS builder | ||
|
||
FROM cgr.dev/chainguard/go:latest AS base | ||
WORKDIR /src | ||
|
||
# Install build dependencies - go build toolchain, and git2go build dependencies (libgit2) | ||
RUN apk update && \ | ||
apk add --no-cache \ | ||
go \ | ||
build-base \ | ||
cmake \ | ||
pkgconf \ | ||
openssl-dev \ | ||
pcre2-dev \ | ||
zlib-dev \ | ||
libssh2-dev \ | ||
libgit2-dev=1.7.2-r0 | ||
|
||
# Copy source code | ||
COPY go.mod go.sum ./ | ||
RUN --mount=type=cache,target=/root/go/pkg/mod,sharing=locked \ | ||
go mod download | ||
|
||
FROM base AS src | ||
|
||
WORKDIR /src | ||
COPY . . | ||
|
||
|
||
# migrate | ||
FROM src AS build-migrate | ||
LABEL io.quantm.artifacts.app="quantm" | ||
LABEL io.quantm.artifacts.component="migrate" | ||
|
||
RUN --mount=type=cache,target=/root/go/pkg/mod,sharing=locked \ | ||
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \ | ||
go build -o ./build/migrate ./cmd/jobs/migrate | ||
|
||
FROM cgr.dev/chainguard/git:latest-glibc AS migrate | ||
|
||
COPY --from=build-migrate /src/build/migrate /bin/migrate | ||
|
||
ENTRYPOINT [ ] | ||
CMD ["/bin/migrate"] | ||
|
||
|
||
# mothership | ||
FROM src AS build-mothership | ||
LABEL io.quantm.artifacts.app="quantm" | ||
LABEL io.quantm.artifacts.component="mothership" | ||
|
||
RUN --mount=type=cache,target=/root/go/pkg/mod,sharing=locked \ | ||
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \ | ||
go build -o ./build/mothership ./cmd/workers/mothership | ||
|
||
FROM cgr.dev/chainguard/git:latest-glibc AS mothership | ||
|
||
COPY --from=build-mothership /src/build/mothership /bin/ | ||
|
||
ENTRYPOINT [ ] | ||
CMD ["/bin/mothership"] | ||
|
||
|
||
# api | ||
FROM src AS build-api | ||
LABEL io.quantm.artifacts.app="quantm" | ||
LABEL io.quantm.artifacts.component="api" | ||
|
||
# Build the quantm binary with static linking | ||
RUN --mount=type=cache,target=/root/go/pkg/mod,sharing=locked \ | ||
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \ | ||
go build -o ./build/api ./cmd/api | ||
go build -tags static,system_libgit2 \ | ||
-o /build/quantm \ | ||
./cmd/quantm | ||
|
||
FROM cgr.dev/chainguard/git:latest-glibc AS api | ||
# Runtime Stage (Static base) | ||
FROM cgr.dev/chainguard/static AS quantm | ||
|
||
COPY --from=build-api /src/build/api /bin/api | ||
COPY --from=builder /build/quantm /bin/quantm | ||
|
||
ENTRYPOINT [ ] | ||
CMD ["/bin/api"] | ||
ENTRYPOINT ["/bin/quantm"] | ||
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.