Skip to content

Commit

Permalink
Adjust from previous example reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinWiseOne committed Mar 12, 2024
1 parent 83dc4a5 commit 62ebfec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
4 changes: 1 addition & 3 deletions Core/Panel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# automatically when running in Edge, or by the "ci" module when running
# locally.


# First stage

ARG BASE_IMAGE=quay.io/enthought/edm-centos-7:latest
Expand Down Expand Up @@ -46,9 +47,6 @@ COPY --from=stage_one --chown=app /home/app/.edm /home/app/.edm
# Don't change the user, and in particular don't make the user "root".

# Copy startup script and application.
# Note: the startup script must be placed in /home/app for the base image
# machinery to pick it up.

COPY --chown=app ./src/startup-script.sh /home/app/startup-script.sh
RUN chmod +x /home/app/startup-script.sh
COPY --chown=app ./src/app.py /home/app/app.py
Expand Down
2 changes: 1 addition & 1 deletion Core/React/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# First stage

ARG BASE_IMAGE=quay.io/enthought/edm-centos-7:3.4.0
ARG BASE_IMAGE=quay.io/enthought/edm-centos-7:latest

FROM $BASE_IMAGE as stage_one

Expand Down
21 changes: 4 additions & 17 deletions Core/React/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ collecting environment variables set by Edge when the container is launched.

When developing locally, it's also convenient to have an EdgeSession. You
can get the "ci" module to inject the appropriate environment variables, so
that your ``EdgeSession()`` call will work with ``python -m ci run`` and
``python -m ci preflight``.
that your ``EdgeSession()`` call will work with ``python -m ci run``.

To do so, follow this procedure:

Expand All @@ -109,8 +108,8 @@ To do so, follow this procedure:
``"https://edge.enthought.com/services/api"``.
* Define EDGE_API_ORG in that file. This is the "short name" displayed in
the URL bar when you log into an organization, for example, ``"default"``.
* Define EDGE_API_TOKEN. You can get one of these by going to the
``/hub/token`` endpoint on the Edge server.
* Define EDGE_API_TOKEN. You can get one of these from the ``My Profile``page
in the Edge UI.

Be sure *not* to check the "dev_settings.json" file into source control, as it
contains your API token.
Expand Down Expand Up @@ -138,16 +137,7 @@ found.
## Viewing console output

When running with ``python -m ci run``, the app's output will be displayed
on the console where you launched it. Once you've launched your app locally,
you can use the ``docker logs``command to see output:

```
$ docker logs edge-react-core -f
```

(If you've changed the IMAGE constant in ``ci/__main__.py``, replace
"edge-react-core" above with the new image name).

on the console where you launched it.

## Guidelines for your Dockerfile

Expand All @@ -157,9 +147,6 @@ the prefix from requests, handling the OAuth2 login flow, pinging JupyterHub
for container activity, and more. But, there are a few guidelines you will
need to follow in your own Dockerfile.

* Don't change the user to anything other than ``app`` (for example, by the
Dockerfile ``USER`` command). If you need to run ``yum`` for some reason,
use ``sudo``.
* Your app should bind to ``127.0.0.1``, *not* ``0.0.0.0``, and it should serve
on port 9000. The Edge machinery will respond to requests on port 8888 and
forward them to your app.
Expand Down
4 changes: 1 addition & 3 deletions Core/React/ci/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"six",
]

# This will be used when running locally ("run" or "preflight" commands).
# This will be used when running locally ("run" command).
# We just use the last component of the full image URL.
CONTAINER_NAME = IMAGE.split("/")[-1]

Expand Down Expand Up @@ -90,8 +90,6 @@ def run():
"""Run the Docker image for testing"""

# Get values from the dev settings file (API tokens for testing, etc.)
# Because we are running outside of JupyterHub, we also disable the OAuth2
# machinery.
envs = _load_dev_settings()

cmd = ["docker", "run", "--rm", "-p", "9000:9000", "--name", CONTAINER_NAME]
Expand Down

0 comments on commit 62ebfec

Please sign in to comment.