Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-kelp committed Feb 26, 2024
1 parent 64d9389 commit 1e953e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
23 changes: 12 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ RUN yarn build


FROM python:3.12.1-slim-bullseye as base
WORKDIR /usr/src/app
ENV DEBIAN-FRONTEND noninteractive
ARG IS_PROD
ENV DEBIAN_FRONTEND noninteractive
ENV PIP_NO_CACHE_DIR=1
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_CREATE=0
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /usr/src/app

# 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 \
RUN if [ "$IS_PROD" = "true" ]; then \
PACKAGES_TO_INSTALL="$BASE_PACKAGES"; \
else \
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $DEV_PACKAGES"; \
fi && \
apt-get update && \
Expand All @@ -32,19 +33,19 @@ RUN PACKAGES_TO_INSTALL="$BASE_PACKAGES" && \
# 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 \
RUN if [ "$IS_PROD" = "true" ]; then \
poetry install --only main --no-root; \
else \
poetry install --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

CMD if [ "$ENV" = "development" ]; then \
flask --app OpenOversight.app:app run --host=0.0.0.0 --port=3000; \
else \
CMD if [ "$IS_PROD" = "true" ]; then \
gunicorn -w 4 -b 0.0.0.0:3000 OpenOversight.app:app; \
else \
flask --app OpenOversight.app:app run --host=0.0.0.0 --port=3000; \
fi
2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
ENV: production
IS_PROD: "true"
environment:
ENV: production
volumes:
Expand Down
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ services:
- postgres:/var/lib/postgresql/data

web:
build:
args:
ENV: ${ENV:-development}
restart: always
depends_on:
- postgres
Expand Down

0 comments on commit 1e953e8

Please sign in to comment.