Skip to content

Commit

Permalink
Support docker (#14)
Browse files Browse the repository at this point in the history
chore: add Dockerfile (#13, #14)

Co-authored-by: Queensferry <queensferry.me@gmail.com>
  • Loading branch information
AntiKnot and queensferryme committed Sep 2, 2021
1 parent 45f83ad commit 8abac17
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
@@ -0,0 +1 @@
**/__pycache__/
29 changes: 29 additions & 0 deletions Dockerfile
@@ -0,0 +1,29 @@
FROM python:3.9-alpine

# Setup
RUN addgroup -S app && adduser -S app -G app
RUN apk add --no-cache curl
USER app

# Copy
ENV HOME=/home/app
WORKDIR $HOME/app
COPY --chown=app:app rsserpent rsserpent
COPY --chown=app:app poetry.lock pyproject.toml .

# Dependencies
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
ENV PATH="${HOME}/.local/bin:${HOME}/.poetry/bin:${PATH}"
RUN poetry config virtualenvs.create false && \
poetry add --lock uvicorn && \
poetry install --no-dev

# Cleanup
USER root
RUN apk del curl
RUN yes | poetry cache clear --all .
USER app

# Run
EXPOSE 8000
CMD [ "uvicorn", "rsserpent:app", "--host", "0.0.0.0" ]

0 comments on commit 8abac17

Please sign in to comment.