11# using ubuntu LTS version
2- FROM ubuntu:20 .04 AS builder-image
2+ FROM ubuntu:22 .04 AS builder-image
33
44# avoid stuck build due to user prompt
55ARG DEBIAN_FRONTEND=noninteractive
66
7- RUN apt-get update \
8- && apt-get install \
7+ RUN apt-get -qq update \
8+ && apt-get -qq install \
99 --no-install-recommends -y \
1010 aptitude \
1111 autoconf \
@@ -15,6 +15,7 @@ RUN apt-get update \
1515 curl \
1616 git \
1717 locales \
18+ libbz2-dev \
1819 libffi-dev \
1920 libncurses-dev \
2021 libreadline-dev \
@@ -46,8 +47,8 @@ RUN bash -c "git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf
4647 && echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc \
4748 && echo '. $HOME/.asdf/asdf.sh' >> $HOME/.profile"
4849RUN asdf plugin-add python \
49- && asdf install python 3.10.5 \
50- && asdf global python 3.10.5
50+ && asdf install python 3.10.6 \
51+ && asdf global python 3.10.6
5152
5253ENV POETRY_HOME="$HOME/.poetry"
5354RUN curl -sSL https://install.python-poetry.org | python3.10 -
@@ -60,15 +61,18 @@ RUN python3.10 -m venv /opt/venv
6061# Install pip requirements
6162RUN . /opt/venv/bin/activate && poetry install
6263
63- FROM ubuntu:20.04 AS runner-image
64+ # TODO: dive + docker-slim
65+ FROM ubuntu:22.04 AS runner-image
6466
6567ARG USERNAME=appuser
6668ENV HOME="/home/${USERNAME}"
6769ENV VIRTUAL_ENV="/opt/venv"
68- ENV PATH="${VIRTUAL_ENV}/bin:$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH"
70+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
71+ ENV PATH="${VIRTUAL_ENV}/bin:$HOME/.asdf/bin:$HOME/.asdf/shims:/ms-playwright:$PATH"
6972
7073RUN useradd --create-home $USERNAME \
71- && mkdir -p /home/${USERNAME}/app
74+ && mkdir -p /home/${USERNAME}/app \
75+ && mkdir -p $PLAYWRIGHT_BROWSERS_PATH
7276
7377COPY --chown=${USERNAME}:${USERNAME} . $HOME/app
7478COPY --from=builder-image --chown=${USERNAME}:${USERNAME} /opt/venv /opt/venv
@@ -77,8 +81,8 @@ COPY --from=builder-image --chown=${USERNAME}:${USERNAME} $HOME/.asdf $HOME/.asd
7781# avoid stuck build due to user prompt
7882ARG DEBIAN_FRONTEND=noninteractive
7983
80- RUN apt-get update \
81- && apt-get install \
84+ RUN apt-get -qq update \
85+ && apt-get -qq install \
8286 --no-install-recommends -y \
8387 ca-certificates \
8488 curl \
@@ -99,4 +103,5 @@ USER appuser
99103WORKDIR $HOME/app
100104
101105ENTRYPOINT ["python" , "hello.py" ]
106+ # CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]
102107# CMD ["/bin/bash"]
0 commit comments