-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replace Django with Flask and initial custom exceptions for CLI * revise task definitions, file watchers, format isort * add types * revise build tasks * FE cleanup * Restore GA * fix tests
- Loading branch information
Showing
66 changed files
with
6,302 additions
and
7,284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,51 @@ | ||
FROM python:3.9.7-bullseye as base | ||
FROM python:3.10-bullseye as base | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV POETRY_VERSION 1.1.12 | ||
|
||
COPY requirements.txt /tmp/requirements.txt | ||
|
||
RUN python -m pip install -U pip setuptools | ||
|
||
RUN pip install --no-cache-dir -r /tmp/requirements.txt | ||
RUN pip install poetry==$POETRY_VERSION | ||
|
||
FROM base as dev | ||
|
||
COPY requirements.dev.txt /tmp/requirements.dev.txt | ||
COPY requirements.txt /tmp/requirements.txt | ||
WORKDIR /primerdriver | ||
|
||
RUN pip install --no-cache-dir -r /tmp/requirements.dev.txt | ||
COPY pyproject.toml poetry.lock ./ | ||
|
||
WORKDIR /primerdriver | ||
RUN poetry install | ||
|
||
ENTRYPOINT python manage.py migrate && \ | ||
SHORT_SHA=$(git show --format="%h" --no-patch) gunicorn primerx.wsgi \ | ||
-b 0.0.0.0:5000 \ | ||
--workers 2 \ | ||
--threads 4 \ | ||
--log-file - \ | ||
--capture-output \ | ||
--reload | ||
ENTRYPOINT ["poetry", "run", "flask", "run", "-h", "0.0.0.0", "-p", "5000", "--reload"] | ||
|
||
FROM node:16-alpine as build | ||
FROM node:16-alpine as web_build | ||
|
||
WORKDIR /web | ||
|
||
COPY ./web/app/ ./ | ||
COPY ./web/app/public ./public | ||
COPY ./web/app/src ./src | ||
COPY ./web/app/package.json ./web/app/yarn.lock ./ | ||
|
||
RUN yarn install --prod | ||
|
||
RUN yarn build | ||
RUN yarn install && yarn build | ||
|
||
FROM base as prod | ||
|
||
ARG SHORT_SHA=$SHORT_SHA | ||
ENV SHORT_SHA $SHORT_SHA | ||
|
||
WORKDIR /tmp | ||
|
||
COPY pyproject.toml poetry.lock ./ | ||
|
||
RUN poetry export -f requirements.txt | pip install --no-cache-dir -r /dev/stdin | ||
|
||
WORKDIR /primerdriver | ||
|
||
COPY ./primerdriver/ ./primerdriver/ | ||
COPY ./primerx/ ./primerx/ | ||
COPY ./sdm/ ./sdm/ | ||
COPY ./manage.py ./manage.py | ||
COPY --from=build /web/build ./web/app/ | ||
COPY ./*.py ./ | ||
COPY ./*.sh ./ | ||
COPY --from=web_build /web/build ./web/app/ | ||
|
||
ARG SHORT_SHA=$SHORT_SHA | ||
|
||
ENV SHORT_SHA $SHORT_SHA | ||
EXPOSE $PORT | ||
|
||
ENTRYPOINT python manage.py collectstatic --noinput && \ | ||
python manage.py migrate && \ | ||
gunicorn primerx.wsgi -b 0.0.0.0:$PORT --workers 1 --threads 2 --log-file - | ||
ENTRYPOINT [ "gunicorn", "-b", "0.0.0.0:$PORT", "-c", "./gunicorn.conf.py" ] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,54 @@ | ||
version: '3' | ||
|
||
env: | ||
NAME: primerdriver-dev | ||
SHORT_SHA: | ||
sh: git show --format="%h" --no-patch | ||
|
||
tasks: | ||
default: | ||
cmds: | ||
- docker compose up -d --build --remove-orphans | ||
- docker compose -p $NAME up -d --build --remove-orphans {{.CLI_ARGS}} | ||
- task logs | ||
|
||
logs: | ||
cmds: | ||
- docker compose logs --follow | ||
- docker compose -p $NAME logs --follow {{.CLI_ARGS}} | ||
|
||
make-builder: | ||
test: | ||
cmds: | ||
- docker build -t kvdomingo/primerdriver-makelinux:latest -f Dockerfile.build . | ||
- poetry run python -m unittest {{.CLI_ARGS}} | ||
|
||
publish-builder: | ||
make-builder: | ||
cmds: | ||
- docker push kvdomingo/primerdriver-makelinux:latest | ||
- docker build -t kvdomingo/primerdriver-makelinux:latest -f build.Dockerfile . | ||
- docker push kvdomingo/primerdriver-makelinux:latest | ||
|
||
build-linux: | ||
cmds: | ||
- docker run -v "$(pwd)":/primerdriver --rm --name primerdriver-makelinux kvdomingo/primerdriver-makelinux:latest | ||
|
||
build: | ||
cmds: | ||
- pyinstaller --clean -F --name primerdriver setup.py | ||
- poetry run pyinstaller --clean -F --name primerdriver setup.py | ||
|
||
build-all: | ||
cmds: | ||
- task build | ||
- task build-linux | ||
|
||
shutdown: | ||
cmds: | ||
- docker compose stop | ||
- docker compose -p $NAME stop {{.CLI_ARGS}} | ||
|
||
restart: | ||
cmds: | ||
- docker compose restart | ||
- docker compose -p $NAME restart {{.CLI_ARGS}} | ||
|
||
restart-proxy: | ||
reload-proxy: | ||
cmds: | ||
- docker compose restart proxy | ||
- docker compose -p $NAME exec -- proxy nginx -s reload | ||
|
||
clean: | ||
cmds: | ||
- docker compose down -v --remove-orphans | ||
- docker compose -p $NAME down -v --remove-orphans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM python:3.10-bullseye | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV POETRY_VERSION 1.1.13 | ||
|
||
RUN apt-get update && apt-get install upx-ucl libgfortran-10-dev libquadmath0 -y | ||
|
||
RUN pip install "poetry==$POETRY_VERSION" | ||
|
||
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /bin | ||
|
||
WORKDIR /primerdriver | ||
|
||
COPY pyproject.toml poetry.lock ./ | ||
|
||
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi | ||
|
||
|
||
ENTRYPOINT [ "/bin/task", "build" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
wsgi_app = "primerx.wsgi" | ||
|
||
worker_class = "gthread" | ||
workers = 1 | ||
threads = 2 | ||
|
||
errorlog = "-" | ||
accesslog = "-" | ||
capture_output = True | ||
loglevel = "error" |
Oops, something went wrong.