-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
49 lines (37 loc) · 1.28 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM python:3.12-slim
# Set environment variables for Poetry
ENV POETRY_VERSION=1.8.4
ENV POETRY_HOME=/opt/poetry
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_IN_PROJECT=1
ENV POETRY_VIRTUALENVS_CREATE=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"
# Install Poetry and dependencies
RUN apt-get update && apt-get install -y curl && \
curl -sSL https://install.python-poetry.org | python3 - && \
ln -s ${POETRY_HOME}/bin/poetry /usr/local/bin/poetry
# Set the working directory
WORKDIR /app
COPY . /app
#COPY poetry.lock pyproject.toml /app/
# Install dependencies
RUN poetry install --with dev --no-interaction # --no-root
# Enable bash-completion and set bash as the default shell
RUN echo "alias ll='ls -la'" >> ~/.bashrc && \
echo "alias poetry='poetry run'" >> ~/.bashrc
## Run tests and verify the package build
#RUN poetry run pytest && \
#poetry build && \
#pip install dist/*.whl
# Configure the shell to automatically activate the venv
RUN echo "source ${VIRTUAL_ENV}/bin/activate" >> ~/.bashrc
# Logging message
COPY motd /etc/motd
# Set permissions on the motd file
RUN chmod 644 /etc/motd
# Ensure the MOTD is displayed on login
RUN echo "cat /etc/motd" >> /root/.bashrc
CMD ["/usr/bin/bash"]