Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to docker files to align with new volttron version #80

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG image_repo=ubuntu
ARG image_tag=20.04
ARG image_repo=rust
ARG image_tag=bookworm
#
FROM ${image_repo}:${image_tag} as volttron_base
FROM ${image_repo}:${image_tag} AS volttron_base
#
SHELL [ "bash", "-c" ]
#
ENV OS_TYPE=debian
ENV DIST=bullseye
ENV DIST=bookworm
ENV VOLTTRON_GIT_BRANCH=main
ENV VOLTTRON_USER_HOME=/home/volttron
ENV VOLTTRON_HOME=${VOLTTRON_USER_HOME}/.volttron
Expand All @@ -30,6 +30,7 @@ RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \
python3-dev \
python3-pip \
python3-setuptools \
python3-venv \
python3-wheel \
openssl \
libssl-dev \
Expand All @@ -50,10 +51,18 @@ RUN echo UTC > /etc/timezone
# Set default 'python' to 'python3'
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
#
# Set global.break-system-packages to true to allow pip to install packages
#
RUN python3 -m pip config set global.break-system-packages true
#
# Upgrade pip so that we get a pre-compiled wheel for 'cryptopgraphy', which is a dependency of Volttron
# See https://cryptography.io/en/latest/faq/#installing-cryptography-fails-with-error-can-not-find-rust-compiler
RUN pip install --upgrade pip
#
# Install rust and cargo
#
RUN rustup default stable
#
# Create a user called 'volttron'
RUN id -u $VOLTTRON_USER &>/dev/null || adduser --disabled-password --gecos "" $VOLTTRON_USER
#
Expand All @@ -69,19 +78,28 @@ FROM volttron_base AS volttron_core
# copy over /core, i.e. the custom startup scripts for this image
RUN mkdir /startup $VOLTTRON_HOME && \
chown $VOLTTRON_USER.$VOLTTRON_USER $VOLTTRON_HOME
COPY ./core /startup
COPY --chown=volttron:volttron ./core /startup
RUN chmod +x /startup/*
#
# copy over volttron repo
USER $VOLTTRON_USER
COPY --chown=volttron:volttron volttron /code/volttron
WORKDIR /code/volttron
#
# Set global.break-system-packages to true to allow pip to install packages
#
RUN python3 -m pip config set global.break-system-packages true
#
# Upgrade pip so that we get a pre-compiled wheel for 'cryptopgraphy', which is a dependency of Volttron
# See https://cryptography.io/en/latest/faq/#installing-cryptography-fails-with-error-can-not-find-rust-compiler
RUN pip install --upgrade pip

RUN pip install -e . --user
RUN echo "package installed at `date`"

# copy default configs
COPY --chown=volttron:volttron ./platform_config.yml /platform_config.yml
COPY --chown=volttron:volttron ./configs /home/volttron/configs
#COPY --chown=volttron:volttron ./platform_config.yml /platform_config.yml
#COPY --chown=volttron:volttron ./configs /home/volttron/configs


##
Expand Down Expand Up @@ -110,6 +128,9 @@ COPY --chown=volttron:volttron ./configs /home/volttron/configs
# $RMQ_HOME/sbin/rabbitmq-plugins enable rabbitmq_management rabbitmq_federation rabbitmq_federation_management rabbitmq_shovel rabbitmq_shovel_management rabbitmq_auth_mechanism_ssl rabbitmq_trust_store; \
# fi
############################################

RUN python -m pip install zmq

########################################
# The following lines should be run from any Dockerfile that
# is inheriting from this one as this will make the volttron
Expand Down
39 changes: 35 additions & 4 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG image_repo=debian
ARG image_tag=bullseye
ARG image_repo=rust
ARG image_tag=bookworm
#
FROM ${image_repo}:${image_tag} as volttron_base
FROM ${image_repo}:${image_tag} AS volttron_base
#
SHELL [ "bash", "-c" ]
#
ENV OS_TYPE=debian
ENV DIST=bullseye
ENV DIST=bookworm
ENV VOLTTRON_GIT_BRANCH=develop
ENV VOLTTRON_USER_HOME=/home/volttron
ENV VOLTTRON_HOME=${VOLTTRON_USER_HOME}/.volttron
Expand All @@ -27,6 +27,7 @@ RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \
python3-dev \
python3-pip \
python3-setuptools \
python3-venv \
python3-wheel \
openssl \
libssl-dev \
Expand All @@ -43,10 +44,22 @@ RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \
#
# Set default 'python' to 'python3'
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

#
# Set global.break-system-packages to true to allow pip to install packages
#
RUN python3 -m pip config set global.break-system-packages true

#
# Upgrade pip so that we get a pre-compiled wheel for 'cryptopgraphy', which is a dependency of Volttron
# See https://cryptography.io/en/latest/faq/#installing-cryptography-fails-with-error-can-not-find-rust-compiler
RUN pip install --upgrade pip

#
# Install rust and cargo
#
RUN rustup default stable

#
# Create a user called 'volttron'
RUN id -u $VOLTTRON_USER &>/dev/null || adduser --disabled-password --gecos "" $VOLTTRON_USER
Expand All @@ -68,12 +81,27 @@ RUN mkdir $VOLTTRON_HOME && \
USER $VOLTTRON_USER
COPY --chown=volttron:volttron volttron /code/volttron
WORKDIR /code/volttron

#
# Set global.break-system-packages to true to allow pip to install packages
#
RUN python3 -m pip config set global.break-system-packages true
#
# Upgrade pip so that we get a pre-compiled wheel for 'cryptopgraphy', which is a dependency of Volttron
# See https://cryptography.io/en/latest/faq/#installing-cryptography-fails-with-error-can-not-find-rust-compiler
RUN pip install --upgrade pip

#
# Now install volttron required packages
#
RUN pip install -e . --user
RUN echo "package installed at `date`"

#
# Copy the startup files instead of relying on a volume due to needing to use docker build to
# create the image rather than docker-compose build
#
COPY --chown=volttron:volttron core /startup
#
#############################################
## RABBITMQ SPECIFIC INSTALLATION
Expand All @@ -100,6 +128,9 @@ RUN echo "package installed at `date`"
# $RMQ_HOME/sbin/rabbitmq-plugins enable rabbitmq_management rabbitmq_federation rabbitmq_federation_management rabbitmq_shovel rabbitmq_shovel_management rabbitmq_auth_mechanism_ssl rabbitmq_trust_store; \
# fi
############################################

RUN python -m pip install zmq

########################################
# The following lines should be run from any Dockerfile that
# is inheriting from this one as this will make the volttron
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ services:
volumes:
- ./platform_config.yml:/platform_config.yml
- ./configs:/home/volttron/configs
- ./core:/startup
- volttron1-volume:/home/volttron/db
environment:
- CONFIG=/home/volttron/configs
- LOCAL_USER_ID=1000
- TZ=America/Los_Angeles

volumes:
volttron1-volume:
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
environment:
- CONFIG=/home/volttron/configs
- LOCAL_USER_ID=1000
- TZ=America/Los_Angeles

volumes:
volttron1-volume:
Expand Down
Loading