spiff-arena/dev.Dockerfile
Bret Mogilefsky 459aec92d5
Enable having created files match the local user:group (#2090)
* Enable having created file match the local user:group

If you run `docker compose up` with no other arguments, the `process_models` directory and everything in it will be created with `root:root` ownership. That's not great for the local editing use-case. 

With this change, running `UGID="$(id -u):$(id -g)" docker compose up` will result in any created files matching the ownership of the invoking user. If the user doesn't set `UGID`, then the existing ownership (`root:root`) is the the default.

* Remove the need to explicitly mark git repositories safe

By setting `*` for `safe.directory` when the image is built, we remove
the need to run `git config` when starting the app in Docker. This
enables the container to run as any user, not just `root`.

* Use local variable naming convention
2024-09-30 09:15:33 -07:00

22 lines
475 B
Docker

FROM python:3.12.1-slim-bookworm
ARG USER_ID
ARG USER_NAME
ARG GROUP_ID
ARG GROUP_NAME
WORKDIR /app
RUN apt-get update \
&& apt-get install -y -q git-core curl vim-tiny \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN if ! getent group "$GROUP_ID"; then addgroup --gid $GROUP_ID $GROUP_NAME; fi
RUN adduser --uid $USER_ID --gid $GROUP_ID $USER_NAME
RUN git config --global --add safe.directory *
RUN pip install --upgrade pip
RUN pip install poetry==1.8.1