Add a dockerfile and details of how to run it.
This commit is contained in:
parent
58006ebe5f
commit
178ee72fe3
3 changed files with 37 additions and 3 deletions
|
|
@ -37,3 +37,18 @@ deploy_to_test:
|
|||
- curl -X POST -k https://openshift-dev.cern.ch:443/apis/build.openshift.io/v1/namespaces/test-cara/buildconfigs/cara-router/webhooks/${OPENSHIFT_TEST_BUILD_WEBHOOK_SECRET}/generic
|
||||
- curl -X POST -k https://openshift-dev.cern.ch:443/apis/build.openshift.io/v1/namespaces/test-cara/buildconfigs/cara-webservice/webhooks/${OPENSHIFT_TEST_BUILD_WEBHOOK_SECRET}/generic
|
||||
- curl -X POST -k https://openshift-dev.cern.ch:443/apis/build.openshift.io/v1/namespaces/test-cara/buildconfigs/auth-service/webhooks/${OPENSHIFT_TEST_BUILD_WEBHOOK_SECRET}/generic
|
||||
|
||||
|
||||
oci_calculator:
|
||||
# A convenient way for users to run the CARA calculator.
|
||||
stage: deploy
|
||||
image:
|
||||
name: gitlab-registry.cern.ch/ci-tools/docker-image-builder
|
||||
entrypoint: [""]
|
||||
script:
|
||||
# Prepare Kaniko configuration file
|
||||
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||
# Build and push the image from the Dockerfile at the root of the project.
|
||||
# To push to a specific docker tag, amend the --destination parameter, e.g. --destination $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
|
||||
# See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#variables-reference for available variables
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE/calculator:latest
|
||||
|
|
|
|||
7
Dockerfile
Normal file
7
Dockerfile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
FROM python:3.6
|
||||
|
||||
COPY ./ /opt/cara/src
|
||||
RUN python -m venv /opt/cara/app
|
||||
RUN cd /opt/cara/src && /opt/cara/app/bin/pip install -r /opt/cara/src/requirements.txt
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/bin/sh", "-c", "echo 'CARA is running on http://localhost:8080' && echo 'Please see https://gitlab.cern.ch/cara/cara for terms of use.' && /opt/cara/app/bin/python -m cara.apps.calculator --no-debug"]
|
||||
18
README.md
18
README.md
|
|
@ -44,9 +44,20 @@ The software is provided "as is", without warranty of any kind, express or impli
|
|||
In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
|
||||
|
||||
|
||||
## Running CARA locally
|
||||
|
||||
The easiest way to run a version of CARA Calculator is to use docker. A pre-built
|
||||
image of CARA is made available at https://gitlab.cern.ch/cara/cara/container_registry.
|
||||
In order to run cara locally with docker, run the following:
|
||||
|
||||
$ docker run -it -p 8080:8080 gitlab-registry.cern.ch/cara/cara/calculator
|
||||
|
||||
This will start a local version of CARA, which can be visited at http://localhost:8080/.
|
||||
|
||||
|
||||
## Development guide
|
||||
|
||||
### Running the COVID calculator app locally
|
||||
### Running the COVID calculator app in development mode
|
||||
|
||||
```
|
||||
pip install -e . # At the root of the repository
|
||||
|
|
@ -59,7 +70,7 @@ To run with the CERN theme:
|
|||
python -m cara.apps.calculator --theme=cara/apps/calculator/themes/cern
|
||||
```
|
||||
|
||||
### Running the CARA Expert-App app locally
|
||||
### Running the CARA Expert-App app in development mode
|
||||
|
||||
```
|
||||
pip install -e . # At the root of the repository
|
||||
|
|
@ -77,7 +88,7 @@ pip install -e .[test]
|
|||
pytest ./cara
|
||||
```
|
||||
|
||||
### Building the whole environment for local execution
|
||||
### Building the whole environment for local development
|
||||
|
||||
**Simulate the docker build that takes place on openshift with:**
|
||||
|
||||
|
|
@ -202,3 +213,4 @@ $ oc process -f route.yaml --param HOST='test-cara.web.cern.ch' | oc replace -f
|
|||
```
|
||||
|
||||
Be aware that if you change/replace the **route** of the PROD instance, it will loose the annotation to be exposed outside CERN (not committed in this repo).
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue