constellation/3rdparty/gcp-guest-agent/Dockerfile

32 lines
839 B
Docker
Raw Normal View History

FROM ubuntu:22.04@sha256:dda6886d8d153a2d86f046c9335123c6151d83fd63e446b752ed8d9da261205d as build
# Install packages
RUN apt-get update && apt-get install -y \
wget \
git
# Install Go
2022-11-02 06:17:29 -04:00
ARG GO_VER=1.19.3
2022-09-02 06:45:56 -04:00
RUN wget -q https://go.dev/dl/go${GO_VER}.linux-amd64.tar.gz && \
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" ]