2024-05-13 04:18:56 -04:00
|
|
|
FROM ubuntu:22.04@sha256:a6d2b38300ce017add71440577d5b0a90460d0e57fd7aec21dd0d1b0761bbfb2 as build
|
2022-08-09 10:33:37 -04:00
|
|
|
|
|
|
|
# Install packages
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
wget \
|
|
|
|
git
|
|
|
|
|
|
|
|
# Install Go
|
2024-05-08 05:34:31 -04:00
|
|
|
ARG GO_VER=1.22.3
|
2022-09-02 06:45:56 -04:00
|
|
|
RUN wget -q https://go.dev/dl/go${GO_VER}.linux-amd64.tar.gz && \
|
2022-08-09 10:33:37 -04:00
|
|
|
tar -C /usr/local -xzf go${GO_VER}.linux-amd64.tar.gz && \
|
|
|
|
rm go${GO_VER}.linux-amd64.tar.gz
|
|
|
|
ENV PATH ${PATH}:/usr/local/go/bin
|
|
|
|
|
|
|
|
# Download go dependencies
|
|
|
|
WORKDIR /src/
|
|
|
|
COPY go.mod ./
|
|
|
|
COPY go.sum ./
|
|
|
|
RUN go mod download all
|
|
|
|
|
|
|
|
# Build
|
|
|
|
ARG VERSION=latest
|
|
|
|
COPY . /src
|
|
|
|
WORKDIR /src/google_guest_agent
|
|
|
|
RUN CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION}" -mod=readonly
|
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
FROM scratch as run
|
|
|
|
COPY --from=build /src/google_guest_agent/google_guest_agent /
|
|
|
|
COPY instance_configs.cfg /etc/default/
|
|
|
|
ENTRYPOINT [ "/google_guest_agent" ]
|