Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Use a Python image with uv pre-installed
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS uv
# Use the latest as a default, but allow it to be overriden in case we
# want to publish images with different versions of Semgrep.
ARG BASE_IMAGE=semgrep/semgrep:latest

# Use the Semgrep image, so that we can select which version of
# Semgrep we want to distribute with.
FROM ${BASE_IMAGE}

# Add `uv` to the image
RUN apk update && apk add py3-uv

# Install the project into `/app`
WORKDIR /app
Expand All @@ -22,15 +30,15 @@ ADD . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install .

FROM python:3.13-slim-bookworm
# Uninstall, because we want to use the base image's version of Semgrep.
RUN uv pip uninstall semgrep

WORKDIR /app
# need this for `useradd` right after
RUN apk add shadow

# Create non-root user
RUN useradd -m app

COPY --from=uv --chown=app:app /app/.venv /app/.venv

# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONUNBUFFERED=1
Expand Down
Loading