Files
genai-toolbox/Dockerfile
Kurtis Van Gent 7650a0b6d6 ci: improve releasing (#66)
Does a few things to improve releasing process:
- Moves file to .ci folder
- Updates release script to check for version
- Uses printf instead of "echo" to work better between linux/mac
- removes comments about non-mac (worked on linux for me)

I've also updated the tigger to run on new tags.

---------

Co-authored-by: Yuan Teoh <yuanteoh@google.com>
2024-11-26 15:48:58 -07:00

37 lines
1.1 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 METADATA_TAGS=dev
RUN go get ./...
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.metadataString=container.${METADATA_TAGS}"
# 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"]