@@ -32,9 +32,12 @@ ENV POETRY_NO_INTERACTION=1
3232ENV VENV="/opt/venv"
3333ENV PATH="$POETRY_HOME/bin:$VENV/bin:$PATH"
3434
35+ COPY requirements.txt requirements.txt
36+
3537RUN python -m venv $VENV \
36- && . "${VENV}/bin/activate" \
37- && python -m pip install "poetry==${POETRY_VERSION}"
38+ && . "${VENV}/bin/activate" \
39+ && python -m pip install "poetry==${POETRY_VERSION}" \
40+ && python -m pip install -r requirements.txt
3841
3942FROM python:${PYTHON_VERSION}-slim-bullseye AS runner
4043
@@ -67,20 +70,29 @@ RUN apt -qq update && apt -qq install \
6770 curl \
6871 dpkg \
6972 git \
73+ iputils-ping \
7074 lsof \
7175 p7zip \
7276 perl \
77+ shellcheck \
7378 tldr \
7479 tree \
7580 && rm -rf /var/lib/apt/lists/*
7681
77- RUN groupadd ${USER_NAME} \
78- && useradd -m ${USER_NAME} -g ${USER_GROUP}
82+ RUN groupadd $USER_NAME \
83+ && useradd -m $USER_NAME -g $USER_GROUP
84+
85+ # create read/write dirs
86+ RUN <<EOF
87+ # !/usr/bin/env bash
88+ mkdir -p /app/{certs,staticfiles}
89+ chown -R "${USER_NAME}:${USER_GROUP}" /app/
90+ EOF
7991
8092USER $USER_NAME
8193WORKDIR $HOME
8294
83- COPY --from=builder --chown=nonroot:nonroot $VENV $VENV
95+ COPY --from=builder --chown=${USER_NAME}:${USER_GROUP} $VENV $VENV
8496
8597# qol: tooling
8698RUN <<EOF
@@ -99,7 +111,7 @@ yes | ~/.fzf/install
99111EOF
100112
101113# qol: .bashrc
102- RUN <<EOF tee -a $HOME/.bashrc
114+ RUN tee -a $HOME/.bashrc <<EOF
103115# shared history
104116HISTFILE=/var/tmp/.bash_history
105117HISTFILESIZE=100
118130# $PATH
119131ENV PATH=$VENV_PATH/bin:$HOME/.local/bin:$PATH
120132
133+ # port needed by app
134+ EXPOSE 8000
135+
121136CMD ["sleep" , "infinity" ]
0 commit comments