diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..569f843 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +*.pyc +__pycache__ +.idea +venv +.venv +*.map +*.tsbuildinfo \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8274747 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.7-slim + +WORKDIR /app +COPY ./install.sh ./requirements.txt ./ +RUN bash install.sh +COPY ./app.sqlite3 . +COPY ./app ./app +COPY ./core ./core +ENTRYPOINT ["uvicorn", "--host", "0.0.0.0", "--port", "8000", "app.app:app"] +EXPOSE 8000 + +ENV PYTHONUNBUFFERED=1 \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..363fa4a --- /dev/null +++ b/install.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +packages="python3-dev gcc" +apt-get update \ + && apt-get install -y --no-install-recommends $packages + +pip install -r requirements.txt + +apt-get remove -y $packages \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/*