build: use lefthook for pre-commit (#5248)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
update docs update nix-shell to auto install rework custom pre-commit hooks to integrate better add dockerfile for lefthook and integrate into drone add some more hooks for formatting and linting some files Co-authored-by: Darragh Elliott <me@delliott.net> Reviewed-on: #5248 Co-authored-by: delliott <delliott@fsfe.org> Co-committed-by: delliott <delliott@fsfe.org>
This commit was merged in pull request #5248.
This commit is contained in:
41
pre-commit.Dockerfile
Normal file
41
pre-commit.Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
||||
FROM debian:latest
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
# Install deps
|
||||
RUN apt-get update && apt-get install --yes --no-install-recommends \
|
||||
coreutils \
|
||||
curl \
|
||||
file \
|
||||
findutils \
|
||||
git \
|
||||
grep \
|
||||
libxml2 \
|
||||
libxml2-utils \
|
||||
libxslt1.1 \
|
||||
mediainfo \
|
||||
npm \
|
||||
perl-base \
|
||||
rsync \
|
||||
sed \
|
||||
shfmt
|
||||
|
||||
# Install prettier
|
||||
RUN npm install -g prettier
|
||||
# Set uv project env, to persist stuff moving dirs
|
||||
ENV UV_PROJECT_ENVIRONMENT=/root/.cache/uv/venv
|
||||
# Add vent to path
|
||||
ENV PATH="$UV_PROJECT_ENVIRONMENT/bin:$PATH"
|
||||
# Set the workdir
|
||||
WORKDIR /website-source
|
||||
|
||||
# Copy the pyproject and build deps
|
||||
# Done in a seperate step for optimal docker caching
|
||||
COPY ./pyproject.toml .
|
||||
RUN uv sync --no-install-package fsfe_website_build --group dev
|
||||
# Copy everything else
|
||||
COPY . .
|
||||
|
||||
ENTRYPOINT ["bash", "./pre-commit.entrypoint.sh"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user