reworked docker layout

pull/826/head
Damon C 2019-03-28 15:41:45 -07:00
parent 7584aea141
commit 655eb3a2cc
5 changed files with 30 additions and 24 deletions

View File

@ -9,8 +9,6 @@ services:
nucypher-dev: nucypher-dev:
volumes: volumes:
- ../..:/code - ../..:/code
ports:
- 11500
build: build:
context: ../.. context: ../..
dockerfile: dev/docker/Dockerfile dockerfile: dev/docker/Dockerfile
@ -20,7 +18,7 @@ services:
volumes: volumes:
- ../..:/code - ../..:/code
ports: ports:
- 11500 - 11501:11500
image: dev:nucypher image: dev:nucypher
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.1 --rest-port 11500 command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.1 --rest-port 11500
networks: networks:
@ -31,7 +29,7 @@ services:
volumes: volumes:
- ../..:/code - ../..:/code
ports: ports:
- 11500 - 11502:11500
image: dev:nucypher image: dev:nucypher
depends_on: depends_on:
- ursula1 - ursula1
@ -44,7 +42,7 @@ services:
volumes: volumes:
- ../..:/code - ../..:/code
ports: ports:
- 11500 - 11503:11500
image: dev:nucypher image: dev:nucypher
depends_on: depends_on:
- ursula1 - ursula1

View File

@ -1,21 +1,29 @@
FROM python:3.7.0 FROM python:3.7.0
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /code
# Update # Update
RUN apt-get update -y && apt-get upgrade -y && apt-get install gcc libffi-dev wget git -y RUN apt-get update -y && apt-get upgrade -y && apt-get install gcc libffi-dev wget git -y
EXPOSE 11500 # make an install directory
RUN mkdir /install
# add local files needed for install # copy only the exact files needed for install into the container
RUN mkdir /code COPY ./nucypher/__about__.py /install/nucypher/
WORKDIR /code COPY README.md /install
ADD dev-requirements.txt /code/dev-requirements.txt COPY setup.py /install
ADD ./scripts/installation/install_solc.sh /code/install_solc.sh COPY scripts/installation/install_solc.sh /install
COPY dev-requirements.txt /install
COPY requirements.txt /install
COPY dev/docker/scripts/install/entrypoint.sh /install
# install reqs and solc # install reqs and solc
RUN pip install --upgrade pip \ RUN pip install --upgrade pip
&& pip3 install -r dev-requirements.txt --src /usr/local/src \ RUN pip3 install -r /install/dev-requirements.txt --src /usr/local/src
&& ./install_solc.sh RUN /install/install_solc.sh
# finish install with some local volume ops # puts the nucypher executable in bin path
CMD ["./dev/docker/scripts/install/entrypoint.sh"] RUN python /install/setup.py develop
# this gets called after volumes are mounted and so can modify the local disk
CMD ["/install/entrypoint.sh"]

View File

@ -12,11 +12,11 @@ The intention of the Docker configurations in this directory is to enable anyone
Then you can do things like: Then you can do things like:
* run the tests: * run the tests:
`docker run -it dev:nucypher pytest` `docker-compose run nucypher-dev pytest`
* start up an ursula: * start up an ursula:
`docker run -it -p 10151:10151 dev:nucypher nucypher ursula run --dev --federated-only` `docker-compose run nucypher-dev nucypher ursula run --dev --federated-only`
* open a shell: * open a shell:
`docker run -it dev:nucypher bash` `docker-compose run nucypher-dev bash`
* try some of the scripts in `dev/docker/scripts/` * try some of the scripts in `dev/docker/scripts/`

View File

@ -5,9 +5,10 @@ services:
volumes: volumes:
- ../..:/code - ../..:/code
ports: ports:
- 11500 - 10151:10151
build: build:
context: ../.. context: ../..
dockerfile: dev/docker/Dockerfile dockerfile: dev/docker/Dockerfile
image: dev:nucypher image: dev:nucypher
container_name: nucypher-dev container_name: nucypher-dev
working_dir: /code

View File

@ -1,11 +1,10 @@
#!/bin/bash #!/bin/bash
# runs inside docker container with access to local volume. # runs inside docker container with access to local volume.
# this is needed for local development # needed for local development, creates nucypher.egg-info on local disk
# so that the local repository is accessed # if it doesn't exist.
# by shared volume and is executable by 'nucypher' cli
if [ ! -e /code/nucypher.egg-info ]; then if [ ! -e /code/nucypher.egg-info ]; then
echo "First time install..." echo "First time install..."
pip3 install -e . python setup.py develop
fi fi