Skip to content

Commit 9ee7223

Browse files
Bump python, add sqlite, uvicorn startup
1 parent 5c52b36 commit 9ee7223

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ RUN apt-get -qq update \
1919
libffi-dev \
2020
libncurses-dev \
2121
libreadline-dev \
22+
libsqlite3-dev \
2223
libssl-dev \
2324
libtool \
2425
libxslt-dev \
2526
libyaml-dev \
2627
python3 \
2728
python3-dev \
2829
python3-pip \
30+
sqlite3 \
2931
unixodbc-dev \
3032
unzip \
3133
&& rm -rf /var/lib/apt/lists/*
@@ -47,14 +49,15 @@ RUN bash -c "git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf
4749
&& echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc \
4850
&& echo '. $HOME/.asdf/asdf.sh' >> $HOME/.profile"
4951
RUN asdf plugin-add python \
50-
&& asdf install python 3.10.6 \
51-
&& asdf global python 3.10.6
52+
&& asdf install python 3.10.7 \
53+
&& asdf global python 3.10.7
5254

55+
# TODO: test poetry via asdf
5356
ENV POETRY_HOME="$HOME/.poetry"
5457
RUN curl -sSL https://install.python-poetry.org | python3.10 -
5558
ENV PATH "${POETRY_HOME}/bin:$PATH"
5659

57-
WORKDIR /app
60+
WORKDIR $$HOME/app
5861
COPY pyproject.toml poetry.lock ./
5962
RUN python3.10 -m venv /opt/venv
6063

@@ -87,6 +90,8 @@ RUN apt-get -qq update \
8790
ca-certificates \
8891
curl \
8992
git \
93+
libsqlite3-dev \
94+
sqlite3 \
9095
&& rm -rf /var/lib/apt/lists/*
9196

9297
# Keeps Python from generating .pyc files in the container
@@ -102,6 +107,7 @@ USER appuser
102107

103108
WORKDIR $HOME/app
104109

105-
ENTRYPOINT ["python", "hello.py"]
106-
# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]
110+
# ENTRYPOINT ["python", "main.py"]
111+
# CMD ["gunicorn", "-c", "config/gunicorn.conf.py", "main:app"]
112+
CMD ["/bin/bash", "startup.sh"]
107113
# CMD ["/bin/bash"]

startup.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
export VIRTUAL_ENV="/opt/venv"
4+
export PATH="${VIRTUAL_ENV}/bin:$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH"
5+
6+
# source .venv/bin/activate
7+
8+
gunicorn -w 2 -k uvicorn.workers.UvicornWorker main:app -b 0.0.0.0:${PORT:-3000} --log-file -

0 commit comments

Comments
 (0)