Initial work for building dkg docker images.

pull/3115/head
derekpierre 2023-04-19 16:14:34 -04:00 committed by Kieran Prasch
parent 93aba19a97
commit 6fba2c0a18
4 changed files with 79 additions and 2 deletions

View File

@ -1,9 +1,14 @@
FROM nucypher/rust-python:3.8.12
FROM nucypher/rust-python:3.8.16
# set default user
USER $USER
WORKDIR /code
COPY . /code
RUN pip3 install .[ursula]
RUN pip3 install --force-reinstall nucypher-core@git+https://github.com/KPrasch/nucypher-core.git@b2a56784f41e89b702e74c14a56f461c9b8a233f#subdirectory=nucypher-core-python
RUN pip3 install --force-reinstall ferveo@git+https://github.com/nucypher/ferveo.git@2a69e64965c9825765c305c0e6ae7f168af26900#subdirectory=ferveo-python
RUN export PATH="$HOME/.local/bin:$PATH"
CMD ["/bin/bash"]

View File

@ -0,0 +1,47 @@
FROM rust:slim-buster
# prepare container
RUN apt-get update -y
RUN apt-get install -y sudo
# setup user
ARG USER
RUN echo "Creating user $USER"
RUN adduser --disabled-password --gecos '' $USER
RUN adduser $USER sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN chown -R $USER /home/$USER
# install python build dependencies
RUN sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev git docker-compose
# get python
ARG VERSION
RUN echo "Building python version $VERSION"
RUN wget https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz
RUN tar xzvf Python-$VERSION.tgz
# build python
WORKDIR Python-$VERSION
RUN ./configure --enable-optimizations
RUN make
RUN make install
# setup python
RUN cp python /bin
RUN apt-get install -y python3-openssl python3-dev
# setup rust
ENV CARGO_ROOT /usr/local/cargo
ENV PATH $CARGO_ROOT/bin:$PATH
# echo python and rust versions
RUN python3 --version && \
cargo --version && \
rustup --version && \
rustc --version
# set default user
USER $USER

View File

@ -0,0 +1,25 @@
# Rust-Python CircleCI Container
### Setup
```bash
# the default username in the container
# circle ci expects the user "circleci"
export DOCKER_USER=<USERNAME>
# the version of python to build
export PYTHON_VERSION=<VERSION>
```
### Build
```bash
# pass local env vars as build args USER and VERSION
docker build -t nucypher/rust-python:$PYTHON_VERSION . \
--build-arg VERSION=${PYTHON_VERSION} \
--build-arg USER=${DOCKER_USER}
```
### Push
```bash
# docker login or authentication required
docker push nucypher/rust-python:$PYTHON_VERSION
```

View File

@ -53,7 +53,7 @@ msgpack==1.0.5
msgpack-python==0.5.6
multidict==6.0.4 ; python_version >= '3.7'
mypy-extensions==0.4.4 ; python_version >= '2.7'
nucypher-core==0.6.1
nucypher-core==0.6.0
packaging==23.1 ; python_version >= '3.7'
parsimonious==0.9.0
pendulum==3.0.0a1 ; python_version >= '3.7' and python_version < '4.0'