Skip to content

Commit

Permalink
Configurable one-liner revision flag
Browse files Browse the repository at this point in the history
Signed-off-by: Shah, Karan <[email protected]>
  • Loading branch information
MasterSkepticista committed Oct 23, 2024
1 parent 84fa6ba commit 13cd298
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
fx workspace create --prefix example_workspace --template keras_cnn_mnist
cd example_workspace
fx plan initialize -a localhost
fx workspace dockerize --save
fx workspace dockerize --save --revision https://github.com/securefederatedai/openfl.git@develop
- name: Create certificate authority for workspace
run: |
Expand Down
15 changes: 5 additions & 10 deletions openfl-docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# ------------------------------------
# OpenFL Base Image
# $> docker build . -t openfl -f Dockerfile.base \
# [--build-arg BRANCH=develop] \
# [--build-arg SOURCE=https://github.com/USERNAME/openfl.git]
# $> docker build . -t openfl -f Dockerfile.base [--build-arg OPENFL_REVISION=GIT_URL@COMMIT_ID]
# ------------------------------------
FROM ubuntu:22.04 AS base

Expand Down Expand Up @@ -33,12 +31,9 @@ WORKDIR /home/user
ENV PATH=/home/user/.local/bin:$PATH

# Install OpenFL.
ARG SOURCE=https://github.com/securefederatedai/openfl.git
ARG BRANCH=develop
RUN git clone --depth=1 --branch=${BRANCH} ${SOURCE} && \
cd openfl && \
pip install --no-cache-dir -U pip setuptools wheel && \
pip install --no-cache-dir -e . && \
INSTALL_SOURCES=yes ./openfl-docker/licenses.sh
ARG OPENFL_REVISION=https://github.com/securefederatedai/openfl.git@ad53a0fdbefde8bc18404b6ea4d48344956b96ee
RUN pip install --no-cache-dir -U pip setuptools wheel && \
pip install --no-cache-dir git+${OPENFL_REVISION} && \
INSTALL_SOURCES=yes /home/user/.local/lib/python3.10/site-packages/openfl-docker/licenses.sh

CMD ["/bin/bash"]
14 changes: 13 additions & 1 deletion openfl/interface/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,25 @@ def export_() -> str:
default=False,
help="If set, rebuilds docker images with `--no-cache` option.",
)
@option(
"--revision",
required=False,
default=None,
help=(
"Optional, version of OpenFL source code to build base image from. "
"If unspecified, default value in `Dockerfile.base` will be used, "
"typically the latest stable release. "
"Format: <OPENFL_GIT_URL>@<COMMIT_ID/BRANCH>"
),
)
@pass_context
def dockerize_(context, save, rebuild):
def dockerize_(context, save, rebuild, revision):
"""Package current workspace as a Docker image."""

# Docker build options
options = []
options.append("--no-cache" if rebuild else "")
options.append(f"--build-arg OPENFL_REVISION={revision}" if revision else "")
options = " ".join(options)

# Export workspace
Expand Down

0 comments on commit 13cd298

Please sign in to comment.