From 02dbe341c9536e0d3cea727497845edd73e1d28f Mon Sep 17 00:00:00 2001 From: Mootfrost777 Date: Fri, 11 Apr 2025 11:04:49 +0300 Subject: [PATCH] Fix deploy --- .gitignore | 5 +++-- Dockerfile | 12 +++++++----- compose.yml | 15 +++++++++++++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index a919d16..95f86c7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,9 @@ wheels/ # other .idea -.env +.env* *.session *.session-journal oauth.json -resp.json \ No newline at end of file +resp.json +pgdata \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index bfdec5f..388d887 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,11 +12,12 @@ RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ uv sync --frozen --no-install-project -ADD ./app /app/app -ADD uv.lock /app/ -ADD pyproject.toml /app/ -ADD ./alembic /app/alembic -ADD alembic.ini /app +COPY ./app /app/app +COPY uv.lock /app/ +COPY pyproject.toml /app/ +COPY ./alembic /app/alembic +COPY alembic.ini /app +COPY oauth.json /app/ RUN --mount=type=cache,target=/root/.cache/uv \ uv sync --frozen --no-editable @@ -30,4 +31,5 @@ RUN apk add --no-cache ffmpeg COPY --from=builder --chown=app:app /app /app ENV PATH="/app/.venv/bin:$PATH" +ENV PYTHONPATH="/app" WORKDIR /app diff --git a/compose.yml b/compose.yml index 6c6dd88..dd68825 100644 --- a/compose.yml +++ b/compose.yml @@ -4,7 +4,7 @@ services: image: nowplaybot build: . env_file: - - .env + - .env.production restart: unless-stopped command: > sh -c "ls && python -m alembic upgrade head && python app/__main__.py" @@ -13,9 +13,20 @@ services: callback_listener: <<: *bot ports: - - 8080:8080 + - "8080:8080" labels: - traefik.enable=true - traefik.http.routers.music_mootfrost_dev.rule=Host(`music.mootfrost.dev`) - traefik.http.services.music_mootfrost_dev.loadbalancer.server.port=8080 command: python app/callback_listener.py + + db: + image: postgres:17.4-alpine + volumes: + - ./pgdata:/var/lib/postgresql/data/pgdata + restart: unless-stopped + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: owl + POSTGRES_DB: nowplaybot + PGDATA: /var/lib/postgresql/data/pgdata