Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a0b1c47
Added section for web_users generation
ntenney Apr 21, 2025
b1e142b
Modified docker files to use git to clone volttron repo
ntenney Apr 24, 2025
4ffe8fe
Removed entry to get the submodule
ntenney Apr 24, 2025
69bdde7
Removed volttron submodule, and entry in actions to update it
ntenney Apr 24, 2025
78d5f71
Updated README.md file
ntenney Apr 24, 2025
0d43ce9
Added environment variable for specifying the dockerfile
ntenney Apr 25, 2025
f140fe4
Added example of using build arguments for the repo and branch
ntenney Apr 28, 2025
68a9cf5
Split comand line so that it is more readable
ntenney Apr 28, 2025
4c0232f
Added platforms to build arm64 and amd64 images
ntenney May 14, 2025
34cd374
Fix IMAGE_BASE_NAME
ntenney May 14, 2025
811e376
Fix IMAGE_BASE_NAME part 2
ntenney May 14, 2025
9c4b242
Update the ubuntu version of the image used to run the build
ntenney May 14, 2025
0f3983e
Added build args for git repo and branch
ntenney May 15, 2025
9fd0476
Fix for git repo and branch
ntenney May 15, 2025
7b4c0e3
Added variable expansion for the docker image tag
ntenney May 15, 2025
3e2c523
Added changes from pre-commit hooks
ntenney May 15, 2025
fe24b77
Updated login action version
ntenney May 15, 2025
81a214a
Fixes for running the image tests
ntenney May 15, 2025
b7af6a8
Fixed typo in move to using vars for docker_user
ntenney May 15, 2025
5403f11
Set the default docker image tag for publish_develop_image.yml action…
ntenney May 16, 2025
f77e0f3
Testing variables
ntenney May 16, 2025
668910d
testing setting the image tag based on the branch
ntenney May 16, 2025
8a2346e
Fix typo
ntenney May 16, 2025
4a22893
Fixed image name in docker-copmpose.yml file. Additional clean up of …
ntenney May 16, 2025
7bf03c6
Changed out dockerhub log in process
ntenney May 16, 2025
7833e0b
Changes due to pre-commit hooks
ntenney May 16, 2025
dbf7345
switched out docker build for run commands
ntenney May 17, 2025
9b2f09c
Testing
ntenney May 19, 2025
89d88bf
testing pull_request_target
ntenney May 19, 2025
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
5 changes: 4 additions & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:

jobs:
create_release_publish_to_dhub:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
Expand Down Expand Up @@ -93,6 +93,8 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
platforms: linux/amd64,linux/arm64

# Ensure that the repo has the username and token added from the
# official Volttron Dockerhub page at https://hub.docker.com/repository/docker/eclipsevolttron/volttron/general
Expand All @@ -109,6 +111,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_BASE_NAME }}:${{ env.VERSION }}
Expand Down
88 changes: 64 additions & 24 deletions .github/workflows/publish_develop_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ on:
branches:
- develop
workflow_dispatch:
pull_request:
pull_request_target:
types: [opened, reopened, synchronize]
env:
# Image name on Volttron DockerHub account at https://hub.docker.com/orgs/eclipsevolttron
IMAGE_BASE_NAME: eclipsevolttron/volttron
IMAGE_BASE_NAME: ${{vars.IMAGE_BASE_NAME || 'eclipsevolttron/volttron'}}
IMAGE_TAG: ${{ vars.IMAGE_TAG || github.ref == 'refs/heads/develop' && 'develop' || 'test-build'}}
VOLTTRON_GIT_REPO: ${{vars.VOLTTRON_GIT_REPO || 'https://github.com/VOLTTRON/volttron.git'}}
VOLTTRON_GIT_BRANCH: ${{vars.VOLTTRON_GIT_BRANCH || 'develop'}}

jobs:
publish_develop_to_dhub:
Expand All @@ -26,33 +29,80 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Clone submodule
run: git submodule update --init --recursive

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
platforms: linux/amd64,linux/arm64

# Ensure that the repo has the username and token added from the
# official Volttron Dockerhub page at https://hub.docker.com/repository/docker/eclipsevolttron/volttron/general
# On instructions how to do this, see https://docs.github.com/en/actions/guides/publishing-docker-images
# https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_API_TOKEN }}
run: |
if [ -n "${{ vars.DOCKER_USER }}" -a -n "${{ secrets.DOCKER_API_TOKEN }}" ]; then
echo " "
echo "Connecting to docker"

echo "${{ secrets.DOCKER_API_TOKEN }}" | docker login -u "${{ vars.DOCKER_USER }}" --password-stdin
status=$?
if [ $status -ne 0 ]; then
echo "Error: status $status"
exit 1
fi
fi

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ${{ env.DOCKERFILE || './Dockerfile' }}
platforms: linux/amd64,linux/arm64
build-args: |
volttron_git_branch=${{ env.VOLTTRON_GIT_BRANCH }}
volttron_repo=${{ env.VOLTTRON_GIT_REPO }}
push: true
tags: |
${{ env.IMAGE_BASE_NAME }}:develop
${{ env.IMAGE_BASE_NAME }}:${{ env.IMAGE_TAG }}

# - name: Build Image
# id: docker_build
# run: |
# echo "Building image"
# echo "docker buildx build \
# --build-arg volttron_git_branch=${{ env.VOLTTRON_GIT_BRANCH }} \
# --build-arg volttron_repo=${{ env.VOLTTRON_GIT_REPO }} \
# --platform linux/amd64,linux/arm64 \
# -t ${{ env.IMAGE_BASE_NAME }}:${{ env.IMAGE_TAG }} \
# -f ${{ env.DOCKERFILE || './Dockerfile' }} --no-cache --force-rm --load ."
# docker buildx build \
# --build-arg volttron_git_branch=${{ env.VOLTTRON_GIT_BRANCH }} \
# --build-arg volttron_repo=${{ env.VOLTTRON_GIT_REPO }} \
# --platform linux/amd64,linux/arm64 \
# -t ${{ env.IMAGE_BASE_NAME }}:${{ env.IMAGE_TAG }} \
# -f ${{ env.DOCKERFILE || './Dockerfile' }} --load .
# status=$?
# if [ $status -ne 0 ]; then
# echo "Error: status $status"
# exit 1
# fi
#
# - name: Push Image
# id: docker_push
# run: |
# echo "Pushing image"
# # docker images
# echo "docker push ${{ env.IMAGE_BASE_NAME }}:${{ env.IMAGE_TAG }}"
# echo "digest=$(docker push ${{ env.IMAGE_BASE_NAME }}:${{ env.IMAGE_TAG }} | grep '${{env.IMAGE_TAG}}: digest:')" >> $GITHUB_OUTPUT
# status=$?
# if [ $status -ne 0 ]; then
# echo "Error: status $status"
# exit 1
# fi

# - name: Show publish digest
# run: |
# echo "docker_push.outputs.digest: ${{ steps.docker_push.outputs.digest }}"

- name: Check image publish
if: steps.docker_build.outputs.digest == ''
Expand All @@ -61,14 +111,4 @@ jobs:
- name: Image Digest
run: echo ${{ steps.docker_build.outputs.digest }}

# https://github.com/marketplace/actions/docker-hub-description
# Currently doesn't work with personal access tokens; see https://github.com/peter-evans/dockerhub-description/issues/10
# when fixed, uncomment this step
# - name: Update DockerHub repo README
# uses: peter-evans/dockerhub-description@v2
# with:
# username: ${{ secrets.DOCKER_USER }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# readme-filepath: ./README_DHUB.md

- run: echo "🍏 This job's status is ${{ job.status }}."
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
[submodule "volttron"]
path = volttron
url = https://github.com/volttron/volttron
branch = main
38 changes: 23 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
ARG image_repo=rust
ARG image_tag=bookworm
#

FROM ${image_repo}:${image_tag} AS volttron_base

ARG volttron_repo=https://github.com/VOLTTRON/volttron.git
ARG volttron_git_branch=main
#
SHELL [ "bash", "-c" ]
#
ENV OS_TYPE=debian
ENV DIST=bookworm
ENV VOLTTRON_GIT_BRANCH=main
ENV VOLTTRON_GIT_BRANCH=${volttron_git_branch}
ENV VOLTTRON_USER_HOME=/home/volttron
ENV VOLTTRON_HOME=${VOLTTRON_USER_HOME}/.volttron
ENV CODE_ROOT=/code
ENV VOLTTRON_ROOT=${CODE_ROOT}/volttron
ENV VOLTTRON_USER=volttron
ENV USER_PIP_BIN=${VOLTTRON_USER_HOME}/.local/bin
ENV CONFIG=/home/volttron/configs
ENV TZ=UTC
ENV LOCAL_USER_ID=1000
#ENV RMQ_ROOT=${VOLTTRON_USER_HOME}/rabbitmq_server
#ENV RMQ_HOME=${RMQ_ROOT}/rabbitmq_server-3.7.7
#
USER root
#
RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \
procps \
gosu \
Expand All @@ -45,23 +48,24 @@ RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \
libffi-dev \
sqlite3
#
# Set timezone
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 @@ -74,17 +78,23 @@ RUN mkdir -p /code && chown $VOLTTRON_USER.$VOLTTRON_USER /code && \
# Creating volttron_core stage
############################################
FROM volttron_base AS volttron_core
#

ARG volttron_repo=https://github.com/VOLTTRON/volttron.git
ARG volttron_git_branch=main

# 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 --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

RUN git clone --branch ${volttron_git_branch} --single-branch ${volttron_repo} ${VOLTTRON_ROOT}
WORKDIR ${VOLTTRON_ROOT}

#
# Set global.break-system-packages to true to allow pip to install packages
#
Expand All @@ -94,15 +104,13 @@ RUN python3 -m pip config set global.break-system-packages true
# 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 default configs
#COPY --chown=volttron:volttron ./platform_config.yml /platform_config.yml
#COPY --chown=volttron:volttron ./configs /home/volttron/configs


##
#
#############################################
## RABBITMQ SPECIFIC INSTALLATION
#############################################
Expand Down
32 changes: 20 additions & 12 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
ARG image_repo=rust
ARG image_tag=bookworm
#

FROM ${image_repo}:${image_tag} AS volttron_base

ARG volttron_repo=https://github.com/VOLTTRON/volttron.git
ARG volttron_git_branch=develop
#
SHELL [ "bash", "-c" ]
#
ENV OS_TYPE=debian
ENV DIST=bookworm
ENV VOLTTRON_GIT_BRANCH=develop
ENV VOLTTRON_GIT_BRANCH=${volttron_git_branch}
ENV VOLTTRON_USER_HOME=/home/volttron
ENV VOLTTRON_HOME=${VOLTTRON_USER_HOME}/.volttron
ENV CODE_ROOT=/code
ENV VOLTTRON_ROOT=${CODE_ROOT}/volttron
ENV VOLTTRON_USER=volttron
ENV USER_PIP_BIN=${VOLTTRON_USER_HOME}/.local/bin
ENV CONFIG=/home/volttron/configs
ENV TZ=UTC
ENV LOCAL_USER_ID=1000
#ENV RMQ_ROOT=${VOLTTRON_USER_HOME}/rabbitmq_server
#ENV RMQ_HOME=${RMQ_ROOT}/rabbitmq_server-3.7.7
#
Expand Down Expand Up @@ -72,15 +78,22 @@ RUN mkdir -p /code && chown $VOLTTRON_USER.$VOLTTRON_USER /code && \
# Creating volttron_core stage
############################################
FROM volttron_base AS volttron_core
#
# make the volttron home directory
RUN mkdir $VOLTTRON_HOME && \

ARG volttron_repo=https://github.com/VOLTTRON/volttron.git
ARG volttron_git_branch=develop

# 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 --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

RUN git clone --branch ${volttron_git_branch} --single-branch ${volttron_repo} ${VOLTTRON_ROOT}
WORKDIR ${VOLTTRON_ROOT}

#
# Set global.break-system-packages to true to allow pip to install packages
Expand All @@ -97,11 +110,6 @@ RUN pip install --upgrade pip
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 Down
Loading