Skip to content

x/pkgsite: Dockerfile.frontend should use a scratch base image #48605

@sfllaw

Description

@sfllaw

Problem

Currently, devtools/docker/Dockerfile.frontend uses the golang image as its base image.

This is inconsistent with modern best practices, where services are typically hosted on the minimal scratch image. The current image has an entire operating system and the Go toolchain included, which is unnecessary because only the frontend and its data are copied in. The frontend doesn’t need an entire OS to run.

Suggested solution

  1. Build cmd/frontend with CGO_ENABLED=0 to produce a statically linked binary.
  2. Use FROM scratch to build the final Docker image.

Links

Related: #39827

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.pkgsite

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions