-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
SteBaum
committed
Sep 27, 2024
1 parent
de8296e
commit bc5d76e
Showing
2 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM python:3.9-slim | ||
|
||
# Set arguments for UID and GID | ||
ARG USER_NAME=tdp-lib | ||
ARG USER_UID=1000 | ||
ARG USER_GID=1000 | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
curl \ | ||
git \ | ||
openssh-client \ | ||
sudo \ | ||
vim \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create a group with the same GID as the host user | ||
RUN groupadd --gid $USER_GID $USER_NAME | ||
|
||
# Create a user with the same UID as the host user and add them to the sudo group | ||
RUN useradd --uid $USER_UID --gid $USER_GID --create-home $USER_NAME && \ | ||
echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
# Switch to the new user | ||
USER $USER_NAME | ||
|
||
# Set environment variables for virtual environment | ||
ENV VIRTUAL_ENV="/home/$USER_NAME/venv" | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
# Create a virtual environment | ||
RUN python -m venv $VIRTUAL_ENV | ||
|
||
# Create the tdp directory | ||
RUN mkdir /home/$USER_NAME/tdp | ||
|
||
# Set tdp as working directory | ||
WORKDIR /home/$USER_NAME/tdp | ||
|
||
# Copy all files | ||
COPY . . | ||
|
||
# Install Poetry | ||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
# Add Poetry to PATH | ||
ENV PATH="/home/$USER_NAME/.local/bin:$PATH" | ||
|
||
# Set environment variables for Poetry | ||
ENV POETRY_VIRTUALENVS_CREATE=false \ | ||
POETRY_NO_INTERACTION=1 | ||
|
||
# Install python libraries | ||
RUN poetry install -E postgresql-binary -E mysql -E visualization | ||
|
||
CMD ["/bin/bash"] |