Skip to content

Commit

Permalink
Add dockerfile for local development. Update for new dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbouder committed May 14, 2024
1 parent 6845079 commit 532f61d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ pip install nebari-plugin-self-registration

## Running locally with Docker

_Note_: running locally requires a `config.yaml` file to be present within the `self-registration/dev` directory. Please rename the `sample.config.yaml` and update as needed before proceeding:
_Note_: running locally requires a `config.yaml` file to be present within the `self-registration` directory. Please create a copy of the `sample.config.yaml`, rename, and update as needed before proceeding:

1. Navigate to the `self-registration` directory
2. To build the docker image, run the following:

```
docker build . -t self-registration
docker build . --file Dockerfile.local -t self-registration
```

3. To run the app, run the following:
Expand Down
1 change: 0 additions & 1 deletion self-registration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM python:3.12
WORKDIR /app

COPY ./requirements.txt /tmp/requirements.txt
COPY ./dev .

# need to pre-install cython < 3 to avoid pyyaml >= 5.4.1 incompatibility https://github.com/yaml/pyyaml/issues/601
RUN echo "cython<3" > /tmp/constraint.txt
Expand Down
19 changes: 19 additions & 0 deletions self-registration/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.12

WORKDIR /app

COPY ./requirements.txt /tmp/requirements.txt
COPY ./config.yaml .

# need to pre-install cython < 3 to avoid pyyaml >= 5.4.1 incompatibility https://github.com/yaml/pyyaml/issues/601
RUN echo "cython<3" > /tmp/constraint.txt

RUN PIP_CONSTRAINT=/tmp/constraint.txt pip install --no-cache-dir --upgrade -r /tmp/requirements.txt

COPY ./app /app

# Run web app as non-root
RUN useradd -m www
USER www

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
File renamed without changes.
2 changes: 1 addition & 1 deletion self-registration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ docker container stop self-registration
docker container rm self-registration

# Build and Run New Container
docker build . -t self-registration
docker build . --file Dockerfile.local -t self-registration
docker run -d -p 8000:8000 --name self-registration self-registration

0 comments on commit 532f61d

Please sign in to comment.