Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ca806ea
removing old singularity folder
Nov 14, 2024
678f2a3
Add gem installation for zip in Dockerfile
anchapin Mar 28, 2025
de39078
Merge pull request #201 from anchapin/zip
tijcolem Mar 28, 2025
2dc39f4
Update Dockerfile check for bundle_path
jmarrec Apr 7, 2025
e84e6d6
Update manual_installer_test.yml
tijcolem May 2, 2025
dfda828
Merge pull request #202 from jmarrec/patch-1
brianlball May 9, 2025
ece9fce
Merge pull request #198 from NREL/remove_old_singularity_stuff
brianlball May 9, 2025
a03172c
20.04 -> 22.04; @v2->@v4
brianlball May 9, 2025
793b743
3.10.0-alpha
brianlball May 9, 2025
fa1862d
apptainer use develop branch tag until 3.10.0 is on dockerhub
brianlball May 9, 2025
90f8742
fix yml indent typo
brianlball May 9, 2025
8b61988
Merge pull request #204 from NREL/CI-bump
brianlball May 12, 2025
b725643
Update GitHub Actions versions and runner OS
anchapin Nov 19, 2025
7906ff8
Update GitHub Actions workflow to use Ubuntu 22.04 and upgrade OpenSt…
anchapin Nov 19, 2025
13b19f7
Remove trailing newline at the end of the GitHub Actions workflow file
anchapin Nov 19, 2025
0cab2b8
Merge branch 'develop' into update-github-actions-versions
anchapin Nov 19, 2025
21f3a50
Fix CI: Update to ubuntu-24.04 and skip apptainer on PRs
anchapin Nov 19, 2025
6e85468
Fix: Revert OpenStudio version to 3.10.0 and remove version extension
anchapin Nov 19, 2025
6e9921a
Fix Dockerfile: Simplify OpenStudio folder assignment and echo statem…
anchapin Nov 19, 2025
d9e8ce7
Update OpenStudio version to 3.11.0 and set version extension to alph…
anchapin Nov 19, 2025
9c882aa
Refactor OpenStudio folder detection logic in Dockerfile for improved…
anchapin Nov 19, 2025
fb6f444
Enhance OpenStudio folder detection in Dockerfile with improved error…
anchapin Nov 19, 2025
f102e0f
ci: set OpenStudio 3.11.0-alpha download URL and improve deploy tagging
anchapin Nov 19, 2025
bf3bacc
Merge pull request #206 from anchapin/update-github-actions-versions
anchapin Nov 19, 2025
0ce84ee
ci: update deploy script to conditionally push 'latest' tag for stabl…
Nov 27, 2025
210d836
Merge pull request #207 from NREL/auto-update-latest-tag
anchapin Nov 27, 2025
1cf342b
revised version, sha, ext, download_url, and python version to match …
Dec 4, 2025
432c4fd
Merge pull request #209 from NREL/3.11.0-rc1
anchapin Dec 4, 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
141 changes: 75 additions & 66 deletions .github/workflows/docker-openstudio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,96 @@ on: [push, pull_request]
# branches:
# - test_branch

concurrency:
group: openstudio-docker-${{ github.ref }}
cancel-in-progress: true

env:
USE_TESTING_TIMEOUTS: "true"
OPENSTUDIO_VERSION: 3.9.0
OPENSTUDIO_SHA: c77fbb9569
OPENSTUDIO_VERSION_EXT: ""
OPENSTUDIO_VERSION: 3.11.0
OPENSTUDIO_SHA: dee62bf9dd
OPENSTUDIO_VERSION_EXT: "-rc1"
OPENSTUDIO_DOWNLOAD_URL: "https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/develop/OpenStudio-3.11.0-rc1%2Bdee62bf9dd-Ubuntu-22.04-x86_64.deb"

permissions:
contents: read
id-token: write

jobs:
docker:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8.x'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12.x'

- name: test and build
shell: bash
run: |
- name: test and build
shell: bash
run: |
set -euo pipefail
docker build -t openstudio:latest \
--build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_VERSION \
--build-arg OPENSTUDIO_SHA=$OPENSTUDIO_SHA \
--build-arg OPENSTUDIO_VERSION_EXT=$OPENSTUDIO_VERSION_EXT \
--build-arg DOWNLOAD_PREFIX=$DOWNLOAD_PREFIX .
--build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_VERSION \
--build-arg OPENSTUDIO_SHA=$OPENSTUDIO_SHA \
--build-arg OPENSTUDIO_VERSION_EXT=$OPENSTUDIO_VERSION_EXT .
docker run openstudio:latest openstudio openstudio_version
docker run openstudio:latest /usr/local/openstudio-$OPENSTUDIO_VERSION/Radiance/bin/rtrace -version
docker run -v $(pwd):/var/simdata/openstudio openstudio:latest ruby /var/simdata/openstudio/test/test_run.rb
docker run -v $(pwd)/test:/var/simdata/openstudio openstudio:latest ./test_gemfile.sh
docker run -v "$(pwd)":/var/simdata/openstudio openstudio:latest ruby /var/simdata/openstudio/test/test_run.rb
docker run -v "$(pwd)/test":/var/simdata/openstudio openstudio:latest ./test_gemfile.sh

- name: deploy docker
if: ${{ success() }} &&
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/custom_branch_name'
shell: bash
run: ./deploy_docker.sh
env:
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
- name: deploy docker
if: ${{ success() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name') }}
shell: bash
run: |
set -euo pipefail
./deploy_docker.sh
env:
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}

apptainer:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8.x'
runs-on: ubuntu-24.04
needs: docker
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name' }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12.x'

- name: install apptainer
shell: bash
run: |
set -euo pipefail
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer

- name: build apptainer
shell: bash
run: |
set -euo pipefail
apptainer build \
OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \
docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT

- name: install apptainer
shell: bash
run: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer
- uses: actions/upload-artifact@v4
with:
name: apptainer-image
path: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif

- name: build apptainer
shell: bash
run: |
apptainer build \
OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \
docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT

- uses: actions/upload-artifact@v3
with:
name: apptainer-image
path: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::471211731895:role/OpenStudioGitHubActionsRole
role-session-name: GitHubActions
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::471211731895:role/OpenStudioGitHubActionsRole
role-session-name: GitHubActions

- name: Upload artifacts to AWS S3
uses: usualdesigner/s3-artifact-upload@main
with:
bucket-name: openstudio-builds
prefix: ${{env.OPENSTUDIO_VERSION}}
file: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif

- name: Upload artifacts to AWS S3
uses: usualdesigner/s3-artifact-upload@main
with:
bucket-name: openstudio-builds
prefix: ${{ env.OPENSTUDIO_VERSION }}
file: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif
8 changes: 4 additions & 4 deletions .github/workflows/manual_installer_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ env:

jobs:
build_container:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8.x'
python-version: '3.11.x'

- name: test and build
shell: bash
Expand Down
74 changes: 44 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
FROM ubuntu:22.04 AS base

MAINTAINER Nicholas Long nicholas.long@nrel.gov
LABEL maintainer="Nicholas Long nicholas.long@nrel.gov"

# Set the version of OpenStudio when building the container. For example `docker build --build-arg
ARG OPENSTUDIO_VERSION=3.9.0
ARG OPENSTUDIO_VERSION_EXT=""
ARG OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/master/OpenStudio-3.9.0%2Bc77fbb9569-Ubuntu-22.04-x86_64.deb"
ARG OPENSTUDIO_VERSION=3.11.0
ARG OPENSTUDIO_VERSION_EXT="-rc1"
ARG OPENSTUDIO_SHA="dee62bf9dd"
# If OPENSTUDIO_DOWNLOAD_URL is not provided, construct a reasonable default using the
# OpenStudio CI S3 pattern. Users can override by passing --build-arg OPENSTUDIO_DOWNLOAD_URL=...
ARG OPENSTUDIO_DOWNLOAD_URL=""
ENV RC_RELEASE=TRUE
ENV OS_BUNDLER_VERSION=2.4.10
ENV RUBY_VERSION=3.2.2
Expand All @@ -17,19 +20,27 @@ ENV BUNDLE_WITHOUT=native_ext
# install locales and set to en_US.UTF-8. This is needed for running the CLI on some machines
# such as singularity.
RUN apt-get update && apt-get install -y \
curl \
gdebi-core \
libsqlite3-dev \
libssl-dev \
libffi-dev \
build-essential \
zlib1g-dev \
vim \
git \
locales \
sudo \
curl \
gdebi-core \
libsqlite3-dev \
libssl-dev \
libffi-dev \
build-essential \
zlib1g-dev \
vim \
git \
locales \
sudo \
&& if [ -z "${OPENSTUDIO_DOWNLOAD_URL}" ]; then \
ESC_VERSION=$(echo "${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}" | sed 's/+/%2B/g'); \
if [ -n "${OPENSTUDIO_SHA}" ]; then \
OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}%2B${OPENSTUDIO_SHA}-Ubuntu-22.04-x86_64.deb"; \
else \
OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}-Ubuntu-22.04-x86_64.deb"; \
fi; \
fi \
&& echo "OpenStudio Package Download URL is ${OPENSTUDIO_DOWNLOAD_URL}" \
&& curl -SLO $OPENSTUDIO_DOWNLOAD_URL \
&& curl -SLO "$OPENSTUDIO_DOWNLOAD_URL" \
&& OPENSTUDIO_DOWNLOAD_FILENAME=$(ls *.deb) \
# Verify that the download was successful (not access denied XML from s3)
&& grep -v -q "<Code>AccessDenied</Code>" ${OPENSTUDIO_DOWNLOAD_FILENAME} \
Expand All @@ -49,26 +60,29 @@ RUN curl -SLO -k https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz \
&& ./configure \
&& make && make install

## if the openstudio-${OPENSTUDIO_VERSION} folder existed, set it as the OPENSTUDIO
## folder, otherwise set the openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT} folder
## Detect the OpenStudio installation folder
## The folder will be openstudio-3.9.0 or something like openstudio-3.9.0-alpha
## We search for any folder matching the version pattern to handle various naming conventions

#the folder will be Openstudio-3.9.0 or something like Openstudio-3.9.0-alpha

RUN if [ -d "/usr/local/openstudio-${OPENSTUDIO_VERSION}" ]; then \
echo "OpenStudio folder is /usr/local/openstudio-${OPENSTUDIO_VERSION}"; \
OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}; \
else \
echo "OpenStudio folder is /usr/local/openstudio-${OPENSTUDIO_VERSION}-${OPENSTUDIO_VERSION_EXT}"; \
OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}-${OPENSTUDIO_VERSION_EXT}; \
RUN echo "Searching for OpenStudio installation..." \
&& ls -la /usr/local \
&& ls -la /usr \
&& OPENSTUDIO_FOLDER=$(find /usr -maxdepth 2 -type d -name "openstudio-${OPENSTUDIO_VERSION}*" 2>/dev/null | head -1) \
&& if [ -z "$OPENSTUDIO_FOLDER" ]; then \
echo "ERROR: OpenStudio folder not found matching pattern openstudio-${OPENSTUDIO_VERSION}*"; \
echo "Searching for any openstudio folder..."; \
find /usr -maxdepth 2 -type d -name "openstudio-*" 2>/dev/null; \
exit 1; \
fi \
&& echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \
&& ls -la ${OPENSTUDIO_FOLDER} \
&& rm -rf ruby* \
&& gem install bundler -v $OS_BUNDLER_VERSION \
&& gem install zip \
&& mkdir /var/oscli \
&& ls /usr/local \
&& cp ${OPENSTUDIO_FOLDER}/Ruby/Gemfile /var/oscli/ \
&& cp ${OPENSTUDIO_FOLDER}/Ruby/Gemfile.lock /var/oscli/ \
&& cp ${OPENSTUDIO_FOLDER}/Ruby/openstudio-gems.gemspec /var/oscli/\
&& cp ${OPENSTUDIO_FOLDER}/Ruby/openstudio-gems.gemspec /var/oscli/ \
&& ln -s ${OPENSTUDIO_FOLDER} /usr/local/openstudio-${OPENSTUDIO_VERSION}

ENV RUBYLIB=/usr/local/openstudio-${OPENSTUDIO_VERSION}/Ruby
Expand All @@ -86,8 +100,8 @@ RUN bundle _${OS_BUNDLER_VERSION}_ install --path=gems --without=native_ext --jo
# Configure the bootdir & confirm that openstudio is able to load the bundled gem set in /var/gemdata
VOLUME /var/simdata/openstudio
WORKDIR /var/simdata/openstudio
RUN openstudio --loglevel Trace --bundle /var/oscli/Gemfile --bundle_path /var/oscli/gems --bundle_without native_ext openstudio_version
RUN openstudio --loglevel Trace --bundle /var/oscli/Gemfile --bundle_path /var/oscli/gems --bundle_without native_ext gem_list

# May need this for syscalls that do not have ext in path

CMD [ "/bin/bash" ]
CMD [ "/bin/bash" ]
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,31 @@ If gem dependencies are required as part of the CLI outside of those
# Issues

Please submit issues on the project's [Github](https://github.com/nrel/docker-openstudio) page.

## Building and publishing specific OpenStudio versions

- **Local build for a specific version (example: 3.11.0-alpha):**

```bash
docker build -t openstudio:latest \
--build-arg OPENSTUDIO_VERSION=3.11.0 \
--build-arg OPENSTUDIO_VERSION_EXT="-alpha" \
--build-arg OPENSTUDIO_SHA=<sha-or-empty> .
```

- **Tag and push locally (optional):**

```bash
docker tag openstudio:latest yourrepo/openstudio:3.11.0-alpha
docker push yourrepo/openstudio:3.11.0-alpha
```

- **Trigger GitHub Actions build to publish to Docker Hub:**

- Update `.github/workflows/docker-openstudio.yml` env values for `OPENSTUDIO_VERSION`, `OPENSTUDIO_VERSION_EXT`, and `OPENSTUDIO_SHA` on a branch.
- Create a pull request to `develop` and merge; the workflow will build and, if on `develop`, push the image to Docker Hub as the `develop` tag (and `latest`).

Notes:

- The `deploy_docker.sh` script tags images pushed to Docker Hub. You can override `DOCKER_REPO` for testing private repos.
- If `OPENSTUDIO_SHA` is empty, the downloader will attempt to use a generic S3 URL without the SHA.
27 changes: 22 additions & 5 deletions deploy_docker.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
IMAGETAG=${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}
echo "image would be tagged as $IMAGETAG if this were master branch"
echo "default image tag would be $IMAGETAG"
IMAGETAG=skip
DOCKER_REPO=${DOCKER_REPO:-nrel/openstudio}

# Check branch name for correct tagging
if [ "${GITHUB_REF}" == "refs/heads/develop" ]; then
Expand Down Expand Up @@ -29,12 +30,28 @@ fi

# GITHUB_BASE_REF is only set on Pull Request events. Do not build those
if [ "${IMAGETAG}" != "skip" ] && [[ -z "${GITHUB_BASE_REF}" ]]; then
echo "Tagging image as $IMAGETAG"
echo "Tagging image as $IMAGETAG and pushing to ${DOCKER_REPO}"

echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
docker tag openstudio:latest nrel/openstudio:$IMAGETAG; (( exit_status = exit_status || $? ))
docker tag openstudio:latest nrel/openstudio:latest; (( exit_status = exit_status || $? ))
docker push nrel/openstudio:$IMAGETAG; (( exit_status = exit_status || $? ))
# Tag versioned image
docker tag openstudio:latest ${DOCKER_REPO}:$IMAGETAG; (( exit_status = exit_status || $? ))

# Only update and push 'latest' if this is a stable release (no extension)
if [ -z "${OPENSTUDIO_VERSION_EXT}" ]; then
echo "Stable release detected. Updating and pushing '${DOCKER_REPO}:latest'"
docker tag openstudio:latest ${DOCKER_REPO}:latest; (( exit_status = exit_status || $? ))
docker push ${DOCKER_REPO}:latest; (( exit_status = exit_status || $? ))
else
echo "Pre-release detected (extension: '${OPENSTUDIO_VERSION_EXT}'). Skipping 'latest' tag update."
fi

# Push versioned tag
docker push ${DOCKER_REPO}:$IMAGETAG; (( exit_status = exit_status || $? ))
# If on develop branch, also push the develop tag pointing to this image
if [ "${IMAGETAG}" == "develop" ] || [ "${GITHUB_REF}" == "refs/heads/develop" ]; then
docker tag openstudio:latest ${DOCKER_REPO}:develop; (( exit_status = exit_status || $? ))
docker push ${DOCKER_REPO}:develop; (( exit_status = exit_status || $? ))
fi

exit $exit_status
else
Expand Down
Loading
Loading