Skip to content

Commit

Permalink
342 set permissions or owner on src in dockerfile (#343)
Browse files Browse the repository at this point in the history
Closes #342
  • Loading branch information
jcadam14 authored Jul 31, 2024
1 parent 4e2482a commit c25e7ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
FROM ghcr.io/cfpb/regtech/sbl/python-alpine:3.12

ENV UVICORN_LOG_LEVEL=info

WORKDIR /usr/app
RUN mkdir reports
RUN mkdir upload
RUN pip install poetry

COPY poetry.lock pyproject.toml alembic.ini README.md ./

COPY ./src ./src
COPY ./db_revisions ./db_revisions
COPY --chown=sbl:sbl poetry.lock pyproject.toml alembic.ini README.md ./

RUN poetry config virtualenvs.create false
RUN poetry install --only main
RUN poetry install --only main --no-root

COPY --chown=sbl:sbl ./src ./src
COPY --chown=sbl:sbl ./db_revisions ./db_revisions

RUN chmod -R 447 /usr/app/upload

WORKDIR /usr/app/src

EXPOSE 8888

USER sbl

CMD ["python", "sbl_filing_api/main.py"]
CMD uvicorn sbl_filing_api.main:app --host 0.0.0.0 --port 8888 --log-config log-config.yml --log-level $UVICORN_LOG_LEVEL --timeout-keep-alive 65
15 changes: 1 addition & 14 deletions src/sbl_filing_api/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
import os
import uvicorn

from contextlib import asynccontextmanager

Expand All @@ -26,7 +25,7 @@
from alembic.config import Config
from alembic import command

from sbl_filing_api.config import settings, kc_settings
from sbl_filing_api.config import kc_settings

log = logging.getLogger()

Expand Down Expand Up @@ -72,15 +71,3 @@ def run_migrations():


app.include_router(filing_router, prefix="/v1/filing")


if __name__ == "__main__":
uvicorn.run(
"sbl_filing_api.main:app",
host=settings.server_config.host,
port=settings.server_config.port,
timeout_keep_alive=settings.server_config.time_out,
workers=settings.server_config.workers,
reload=settings.server_config.reload,
log_config=settings.server_config.log_config,
)

0 comments on commit c25e7ed

Please sign in to comment.