Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ RUN useradd -r -m quarry && \

WORKDIR /app

COPY requirements.txt /app
# Install dependencies
# TODO: Use a venv instead of --break-system-packages
Comment thread
Vanshika110 marked this conversation as resolved.
# TODO: Use newer pip. That requires newer celery, which in turn requires
# newer versions of basically everything else.
# 1. Update pip, install Poetry, and set venv path
RUN pip install --break-system-packages --upgrade pip==24.0 wheel && \
pip install --break-system-packages -r requirements.txt
pip install --break-system-packages poetry
ENV POETRY_VIRTUALENVS_IN_PROJECT=true

# 2. Copy dependency files
COPY pyproject.toml poetry.lock /app/

# 3. Install dependencies via Poetry
RUN poetry install --no-root --only main --no-interaction

# Copy app code
USER quarry
Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ If you had already run a dev environment (that is, ran `docker-compose up`) you
the containers with the new dependencies by running `docker-compose build` before running
`docker-compose up` again.

### Direct Local Development (Non-Containerized) ###

If you prefer to run the Flask application directly on your machine without Docker, you must first set up the Python environment using Poetry.

**Install Poetry:**
```bash
pip install poetry
```

**Install Dependencies:** Run this command from the project root. It will create a local virtual environment and install all required packages.
```bash
poetry install
```

**Activate Shell and Run:** Run your application (e.g., for testing or running locally):
```bash
poetry shell
flask run
```

**Note:** You may need to run local Redis and database services separately to avoid ConnectionErrors.

## Useful commands ##

To pre-compile nunjucks templates:
Expand Down Expand Up @@ -168,4 +190,4 @@ If ansible doesn't detect a change for quarry helm the following can be run:
`helm -n quarry upgrade --install quarry helm-quarry -f helm-quarry/prod-env.yaml`

For shell access, a debug pod can be created on a running node with something lie
$ kubectl debug node/quarry-127a-g4ndvpkr5sro-node-0 -it --image debian:stable
$ kubectl debug node/quarry-127a-g4ndvpkr5sro-node-0 -it --image debian:stable
Loading
Loading