Install security updates to nginx:mainline-alpine-slim base image in Dockerfile #3626
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds security update installation to the nginx:mainline-alpine-slim base image used in the production stage of the Dockerfile.
Changes
Added commands to update the package index and upgrade all packages after the
FROM nginx:mainline-alpine-slim AS production
statement to ensure all available security updates are installed during the Docker image build process.Why This Change
--no-cache
flag prevents caching the package index, keeping the final image size minimal while ensuring fresh package information is fetched during each buildTechnical Details
apk
as its package managerapk update
refreshes the package index to get the latest package informationapk upgrade --no-cache --available
updates all installed packages to their latest available versions--no-cache
prevents storing the package index locally, reducing image size--available
ensures packages are upgraded to the latest versions available in the repositoryNote on Alpine Security Updates: Alpine Linux does not have a direct equivalent to Debian's
debscan
tool for selective security-only updates. Theapk upgrade --available
command is the recommended approach for applying security updates in Alpine-based containers, as it ensures all packages are updated to their latest versions which include security patches.This change ensures that any security vulnerabilities present in the base nginx:mainline-alpine-slim image packages are patched during the build process.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.