contrib/docker/pytype/Dockerfile
author Anton Shestakov <av6@dwimlabs.net>
Mon, 08 Jan 2024 13:35:02 +0100
changeset 51307 87bfd1703597
permissions -rw-r--r--
contrib: add a set of scripts to run pytype in Docker Having a simple way to run pytype for developers can massively shorten development cycle. Using the same Docker image and scripts that we use on our CI guarantees that the result achieved locally will be very similar to (if not the same as) the output of our CI runners. Things to note: the Dockerfile needs to do a little dance around user permissions inside /home/ci-runner/ because: - on one hand, creating new files on the host (e.g. .pyi files inside .pytype/) should use host user's uid and gid - on the other hand, when we run the image as uid:gid of host user, it needs to be able to read/execute files inside the image that are owned by ci-runner Since local user's uid might be different from ci-runner's uid, we execute this very broad chmod command inside /home/ci-runner/, but then run the image as the host user's uid:gid. There might be a better way to do this.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51307
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     1
FROM registry.heptapod.net/mercurial/ci-images/mercurial-core:v2.0
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     2
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     3
USER ci-runner
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     4
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     5
ENV PATH=/home/ci-runner/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     6
ENV PYTHONPATH=/home/ci-runner/.local/lib/python3.11/site-packages
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     7
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     8
RUN python3 -m pip install --user --break-system-packages --upgrade pytype==2023.11.21
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     9
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    10
ADD --chown=ci-runner entrypoint.sh /home/ci-runner/entrypoint.sh
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    11
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    12
RUN chmod -R a=rwX /home/ci-runner/.local/ /home/ci-runner/entrypoint.sh
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    13
87bfd1703597 contrib: add a set of scripts to run pytype in Docker
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    14
CMD /home/ci-runner/entrypoint.sh