Skip to content

Commit

Permalink
chore: make only one dependency group; copy with chmod at once
Browse files Browse the repository at this point in the history
  • Loading branch information
dantetemplar committed Sep 28, 2024
1 parent af6cadc commit 9dedd6b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ This is the API for music room service in InNoHassle ecosystem.

1. Install dependencies for api if needed:
```bash
poetry install --with api
poetry install
```
2. Run the database if you have not done it yet
3. Upgrade the database schema using [alembic](https://alembic.sqlalchemy.org/en/latest/):
Expand All @@ -120,7 +120,7 @@ Now the API is running on http://localhost:8001. Good job!

1. Install dependencies for bot if needed:
```bash
poetry install --with bot
poetry install
```
2. Run the [API service](#run-for-development-api) or configure the bot to work with the real(production) API.
3. Run the Redis server if needed:
Expand Down
7 changes: 3 additions & 4 deletions api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=${POETRY_HOME} pyt
# and install only runtime deps using poetry
WORKDIR $PYSETUP_PATH
COPY ./poetry.lock ./pyproject.toml ./
RUN poetry install --with api
RUN poetry install


###########################################################
Expand All @@ -48,8 +48,7 @@ FROM base AS production

COPY --from=builder $VENV_PATH $VENV_PATH

COPY ./deploy/docker-entrypoint-alembic.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY --chmod=755 ./deploy/docker-entrypoint.sh ./deploy/docker-entrypoint-alembic.sh /

# Create user with the name poetry
RUN groupadd -g 1500 poetry && \
Expand All @@ -60,5 +59,5 @@ USER poetry
WORKDIR /code

EXPOSE 8000
ENTRYPOINT [ "/docker-entrypoint.sh" ]
ENTRYPOINT [ "/docker-entrypoint-alembic.sh" ]
CMD [ "uvicorn", "src.api.app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips=*" ]
5 changes: 2 additions & 3 deletions bot.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=${POETRY_HOME} pyt
# and install only runtime deps using poetry
WORKDIR $PYSETUP_PATH
COPY ./poetry.lock ./pyproject.toml ./
RUN poetry install --with bot
RUN poetry install


###########################################################
Expand All @@ -48,8 +48,7 @@ FROM base AS production

COPY --from=builder $VENV_PATH $VENV_PATH

COPY ./deploy/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY --chmod=755 ./deploy/docker-entrypoint.sh ./deploy/docker-entrypoint-alembic.sh /

# Create user with the name poetry
RUN groupadd -g 1500 poetry && \
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ colorlog = "^6.8.2"
pre-commit = "^3.6.2"
pyyaml = "^6.0.1"
ruff = "^0.6.8"

[tool.poetry.group.api.dependencies]
alembic = "^1.13.3"
asyncpg = "^0.29.0"
authlib = "^1.3.0"
Expand All @@ -26,8 +24,6 @@ pydantic = { version = "<2.10", extras = ["email"] } # TODO: Update when aiogram
python-docx = "^1.1.0"
sqlalchemy = "^2.0.23"
uvicorn = "^0.31.0"

[tool.poetry.group.bot.dependencies]
aiogram = "^3.4.1"
aiogram-dialog = "^2.2.0"
aiohttp = "^3.9.3"
Expand Down

0 comments on commit 9dedd6b

Please sign in to comment.