diff --git a/.dockerignore b/.dockerignore index c494c45462..bcbb6186c6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,10 @@ -.github/ -.vscode/ **/__pycache__/ -.flake8 -.*ignore +node_modules/ +static/ +.coverage *.db *.egg-info +*.log +*.mo +.DS_Store +.env diff --git a/.gitignore b/.gitignore index 228504a0b4..0b391ee586 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.env *fixtures.json !benefits/core/migrations/local_fixtures.json +*.log *.mo *.tfbackend *.tmp diff --git a/appcontainer/Dockerfile b/appcontainer/Dockerfile index 85023e4f3c..7fd4c34815 100644 --- a/appcontainer/Dockerfile +++ b/appcontainer/Dockerfile @@ -1,25 +1,37 @@ -FROM ghcr.io/cal-itp/docker-python-web:main +FROM ghcr.io/cal-itp/docker-python-web:main AS build_wheel + +WORKDIR /build # upgrade pip -RUN python -m pip install --upgrade pip +RUN python -m pip install --upgrade pip && \ + pip install build + +# copy source files +COPY . . +RUN git config --global --add safe.directory /build + +# build package +RUN python -m build + +FROM ghcr.io/cal-itp/docker-python-web:main AS appcontainer # overwrite default nginx.conf COPY appcontainer/nginx.conf /etc/nginx/nginx.conf COPY appcontainer/proxy.conf /calitp/run/proxy.conf -# copy files needed for version metadata -COPY .git .git - -# copy source files +# copy runtime files +COPY --from=build_wheel /build/dist /build/dist COPY manage.py manage.py COPY bin bin COPY benefits benefits -COPY pyproject.toml pyproject.toml -RUN pip install -e . +RUN echo "$(find /build/dist -name benefits*.whl)" +# install source as a package +RUN pip install $(find /build/dist -name benefits*.whl) -# ensure $USER can compile messages in the locale directories USER root +COPY LICENSE LICENSE +#ensure $USER can compile messages in the locale directories RUN chmod -R 777 benefits/locale USER $USER diff --git a/pyproject.toml b/pyproject.toml index c960d9b113..2b713f8d5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ Documentation = "https://docs.calitp.org/benefits" Issues = "https://github.com/cal-itp/benefits/issues" [build-system] -requires = ["setuptools>=65", "wheel", "setuptools-scm>=8"] +requires = ["setuptools>=65", "setuptools-scm>=8"] build-backend = "setuptools.build_meta" [tool.black] @@ -78,8 +78,9 @@ markers = [ "request_path: use with session_request to initialize with the given path", ] -[tool.setuptools] -packages = ["benefits"] +[tool.setuptools.packages.find] +include = ["benefits*"] +namespaces = false [tool.setuptools_scm] # intentionally left blank, but we need the section header to activate the tool