Skip to content

Commit

Permalink
fix: fix faulty docker config
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyvy-vi committed Aug 7, 2021
1 parent 4335f7f commit 124cc9e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1

# Set pip to have no saved cache
ENV PIP_NO_CACHE_DIR=false \
POETRY_VIRTUALENVS_CREATE=false

# setup poetry
COPY pyproject.toml .
COPY poetry .
COPY pyproject.toml poetry.lock ./
RUN pip3 install poetry
RUN poetry install

Expand All @@ -21,7 +24,7 @@ WORKDIR /home/appuser
USER appuser

# Transfer source to image
COPY . .
COPY src src

# Run bot
CMD [ "python3", "-m" , "src" ]
# Run api
CMD [ "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000" ]
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ version: "3.8"
services:
db:
image: mongo:3.6.20
bot:
api:
build:
context: .
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
MONGO_URI: "mongodb://db:27017"
depends_on:
Expand Down
11 changes: 3 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ name = "heptagram-api"
version = "0.0.1"
description = "An API for the Heptagram Bot"
authors = ["Vyvy-vi <vyom.j@protonmail.com>"]
license = "BSD-3-Clause License"

packages = [
{ include="src", from="." },
]
license = "BSD-3-Clause"
repository = "https://github.com/Heptgram/api"

[tool.poetry.dependencies]
python = "^3.7"
Expand All @@ -33,14 +30,12 @@ taskipy = "^1.8.1"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
start = "src.main:run"

[tool.taskipy.tasks]
lint = "flake8 ."
post_lint = "task format"
format = "task isort && task black"
isort = "isort ."
black = "black ."
start = "uvicorn src.main:app"
precommit = "pre-commit install --hook-type pre-commit --hook-type pre-push"
test = "pytest ."
Empty file added src/__init__.py
Empty file.
7 changes: 1 addition & 6 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,5 @@ def _diceroll(
}
)


def run():
uvicorn.run("src.main:app", reload=True)


if __name__ == "__main__":
run()
uvicorn.run("src.main:app")

0 comments on commit 124cc9e

Please sign in to comment.