forked from lucyparsons/OpenOversight
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use poetry for dependency management
- Loading branch information
Showing
9 changed files
with
3,341 additions
and
109 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,61 +1,50 @@ | ||
FROM python:3.12.1-slim-bullseye as base | ||
# node layer to build static assets | ||
FROM node:16 AS nodejs | ||
WORKDIR /usr/src/app/ | ||
COPY package.json yarn.lock ./ | ||
RUN yarn install | ||
COPY OpenOversight/app/static OpenOversight/app/static | ||
RUN yarn build | ||
|
||
WORKDIR /usr/src/app | ||
|
||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
FROM python:3.12.1-slim-bullseye as base | ||
WORKDIR /usr/src/app | ||
ENV DEBIAN-FRONTEND noninteractive | ||
ENV PYTHONUNBUFFERED=1 | ||
ENV PIP_NO_CACHE_DIR=1 | ||
ENV NODE_MAJOR=16 | ||
ENV POETRY_NO_INTERACTION=1 | ||
ENV POETRY_VIRTUALENVS_CREATE=0 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y ca-certificates curl gnupg && \ | ||
mkdir -p /etc/apt/keyrings && \ | ||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ | ||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \ | ||
# Install packages depending on ENV arg from docker-compose | ||
ARG ENV | ||
ARG BASE_PACKAGES="gcc libpq-dev libjpeg62-turbo-dev libsqlite3-0 zlib1g-dev" | ||
ARG DEV_PACKAGES="firefox-esr xvfb" | ||
RUN PACKAGES_TO_INSTALL="$BASE_PACKAGES" && \ | ||
if [ "$ENV" = "development" ]; then \ | ||
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $DEV_PACKAGES"; \ | ||
fi && \ | ||
apt-get update && \ | ||
apt-get install -y \ | ||
gcc \ | ||
libpq-dev \ | ||
python3-dev \ | ||
nodejs \ | ||
libjpeg62-turbo-dev \ | ||
libsqlite3-0 \ | ||
zlib1g-dev && \ | ||
apt-get install -y -qq --no-install-recommends $PACKAGES_TO_INSTALL && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN npm install -g yarn && \ | ||
mkdir /var/www ./node_modules /.cache /.yarn /.mozilla && \ | ||
touch /usr/src/app/yarn-error.log | ||
COPY yarn.lock /usr/src/app/ | ||
RUN chmod -R 777 /usr/src/app/ /.cache /.yarn | ||
|
||
# Add prod requirements to base image | ||
COPY requirements.txt /usr/src/app/ | ||
RUN pip3 install -r requirements.txt | ||
|
||
COPY package.json /usr/src/app/ | ||
RUN yarn | ||
COPY create_db.py /usr/src/app/ | ||
|
||
WORKDIR /usr/src/app/ | ||
# Add runtime dependencies to base image | ||
RUN pip3 install poetry~=1.8.0 | ||
COPY pyproject.toml poetry.lock ./ | ||
RUN if [ "$ENV" = "development" ]; then \ | ||
poetry install --no-root; \ | ||
else \ | ||
poetry install --only main --no-root; \ | ||
fi | ||
|
||
# Setup application | ||
COPY create_db.py . | ||
COPY OpenOversight OpenOversight | ||
COPY --from=nodejs /usr/src/app/OpenOversight/app/static/dist OpenOversight/app/static/dist | ||
|
||
# Development Target | ||
FROM base as development | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y firefox-esr xvfb && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install additional development requirements | ||
COPY requirements-dev.txt /usr/src/app/ | ||
RUN pip3 install -r /usr/src/app/requirements-dev.txt | ||
|
||
CMD ["OpenOversight/scripts/entrypoint.sh"] | ||
|
||
# Production Target | ||
FROM base as production | ||
CMD ["OpenOversight/scripts/entrypoint.sh"] | ||
CMD if [ "$ENV" = "development" ]; then \ | ||
flask --app OpenOversight.app:app run --host=0.0.0.0 --port=3000; \ | ||
else \ | ||
gunicorn -w 4 -b 0.0.0.0:3000 OpenOversight.app:app; \ | ||
fi |
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 |
---|---|---|
|
@@ -42,7 +42,6 @@ services: | |
web: | ||
build: | ||
context: . | ||
target: development | ||
depends_on: | ||
- postgres | ||
- minio | ||
|
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
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[tool.poetry] | ||
name = "openoversight" | ||
version = "1.8.0" | ||
description = "" | ||
authors = ["OrcaCollective"] | ||
license = "GPLv3" | ||
readme = "README.md" | ||
package-mode = false | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.12" | ||
authlib = "1.3.0" | ||
boto3 = "1.28.39" | ||
cachetools = "5.3.2" | ||
email-validator = "2.1.0.post1" | ||
flask = "3.0.0" | ||
flask-bootstrap = "3.3.7.1" | ||
flask-compress = "1.14" | ||
flask-limiter = "3.3.1" | ||
flask-login = "0.6.3" | ||
flask-mail = "0.9.1" | ||
flask-migrate = "4.0.4" | ||
flask-sitemap = "0.4.0" | ||
flask-sqlalchemy = "3.0.3" | ||
flask-wtf = "1.2.1" | ||
future = "0.18.3" | ||
google-api-python-client = "2.92.0" | ||
gunicorn = "21.2.0" | ||
pillow = "10.1.0" | ||
psycopg2-binary = "2.9.9" | ||
python-dateutil = "2.8.2" | ||
sqlalchemy = "2.0.23" | ||
us = "3.1.1" | ||
wtforms = "3.1.1" | ||
wtforms-sqlalchemy = "0.3" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
faker = "22.6.0" | ||
flake8 = "7.0.0" | ||
ipython = "^8.22.1" | ||
mypy = "1.4.1" | ||
myst-parser = "2.0.0" | ||
pandas = "^2.2.1" | ||
pre-commit = "3.5.0" | ||
pytest = "7.4.3" | ||
pytest-cov = "4.1.0" | ||
pytest-env = "1.0.1" | ||
pytest-flake8 = "1.1.1" | ||
pytest-sugar = "0.9.7" | ||
pytest-xdist = "3.2.1" | ||
selenium = "4.17.2" | ||
sphinx = "7.0.1" | ||
sphinx-autobuild = "2021.3.14" | ||
webdriver-manager = "3.8.6" | ||
xvfbwrapper = "0.2.9" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.