Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
FROM node:lts as build
FROM node:lts AS build

WORKDIR /code
COPY . /code

RUN apt-get update && apt-get install -y chromium
RUN make install-deps-typescript && make install-typescript && make frontend

FROM python:3.11.0 as run
FROM python:3.11.0 AS run

COPY --from=build /code /code
WORKDIR /code
RUN apt update &&\
apt install -y python3-numpy &&\
pip install virtualenv &&\
python3 -m venv venv && \
make install-deps-python &&\
make install-python

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ upstream-sync:
. ./venv/bin/activate && python cre.py --upstream_sync

dev-flask:
. ./venv/bin/activate && INSECURE_REQUESTS=1 FLASK_APP=`pwd`/cre.py FLASK_CONFIG=development flask run
. ./venv/bin/activate && INSECURE_REQUESTS=1 FLASK_APP=`pwd`/cre.py FLASK_CONFIG=development flask run --host=0.0.0.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Host cannot be 0.0.0.0 this exposes your Dev server to the network. There's a reason it's localhost by default

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added --host=0.0.0.0 because when Flask runs inside Docker, binding only to 127.0.0.1 makes the server reachable exclusively from inside the container. Even with -p 5001:5000, the host can’t access the app (resulting in ERR_CONNECTION_RESET), since Flask is not listening on the container’s external interface. Using 0.0.0.0 resolves that and makes the dev container usable on macOS and Linux.

Thanks for pointing this out — I’ll revisit this and look for an approach that keeps the default local behavior secure while still allowing the Docker-based setup to function correctly. I’ll update the PR with a cleaner solution.


e2e:
yarn build
Expand Down Expand Up @@ -83,7 +83,7 @@ docker-prod:
docker build -f Dockerfile -t opencre:$(shell git rev-parse HEAD) .

docker-dev-run:
docker run -it -p 5000:5000 opencre-dev:$(shell git rev-parse HEAD)
docker run -it -p 5001:5000 opencre-dev:$(shell git rev-parse HEAD)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why's this necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On macOS, port 5000 is often reserved by the system AirPlay Receiver service (ControlCe), so docker run -p 5000:5000 fails with: Error: address already in use

This prevents make docker-dev-run from working out-of-the-box for macOS contributors.

Mapping the container’s 5000 to a different host port (5001) avoids the OS-level port conflict while keeping the container port unchanged.

This change fixes the macOS dev experience without affecting Linux/WSL users.


docker-prod-run:
docker run -it -p 5000:5000 opencre:$(shell git rev-parse HEAD)
Expand Down