mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-01-09 15:38:08 -05:00
## Description --- Removing duplication of `container.`. ## PR Checklist --- > Thank you for opening a Pull Request! Before submitting your PR, there are a > few things you can do to make sure it goes smoothly: - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [x] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #1550
38 lines
1.2 KiB
Docker
38 lines
1.2 KiB
Docker
# Copyright 2024 Google LLC
|
|
#
|
|
# 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.
|
|
|
|
# Use the latest stable golang 1.x to compile to a binary
|
|
FROM --platform=$BUILDPLATFORM golang:1 AS build
|
|
|
|
WORKDIR /go/src/genai-toolbox
|
|
COPY . .
|
|
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
ARG BUILD_TYPE="container.dev"
|
|
ARG COMMIT_SHA=""
|
|
|
|
RUN go get ./...
|
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
|
|
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=${BUILD_TYPE} -X github.com/googleapis/genai-toolbox/cmd.commitSha=${COMMIT_SHA}"
|
|
|
|
# Final Stage
|
|
FROM gcr.io/distroless/static:nonroot
|
|
|
|
WORKDIR /app
|
|
COPY --from=build --chown=nonroot /go/src/genai-toolbox/genai-toolbox /toolbox
|
|
USER nonroot
|
|
|
|
ENTRYPOINT ["/toolbox"]
|