Skip to content

Commit

Permalink
Added arm64 builds with support for last MacOS too
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzil committed Apr 29, 2024
1 parent c371487 commit aee30c6
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

platforms: linux/amd64,linux/arm64

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ services:
image: ghcr.io/risingfbk/fluidos-energy-predictor:github
```

MacOS users running on Apple Silicon processors may have issues on new `numpy` versions
due to an impossibility of building a wheel for `h5py`. In this case, build the image
with the `Dockerfile` locate in `docker/arm64-darwin`:

```bash
docker build -t fluidos-energy-demand-predictor -f docker/arm64-darwin/Dockerfile .
```

Pre-built images are available on the [GitHub Container Registry](https://github.com/fluidos-project/fluidos-energy-predictor/pkgs/container/fluidos-energy-predictor)
and on [Docker Hub](https://hub.docker.com/r/fluidos/energy-predictor), both for `x86_64` and `arm64` platforms.

## Data folder structure

For the training, the data folder must contain the following files:
Expand Down
28 changes: 28 additions & 0 deletions docker/arm64-darwin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM --platform=linux/aarch64 python:3.11.4

ARG GIT_TAG
LABEL git_tag="$GIT_TAG"
MAINTAINER Matteo Franzil

COPY . /app
WORKDIR /app

# Install necessary dependencies for building h5py
RUN apt-get update && apt-get install -y \
build-essential \
python3-dev \
pkg-config \
libhdf5-dev \
&& rm -rf /var/lib/apt/lists/*

# Clone h5py and modify setup.py for compatibility
RUN git clone https://github.com/h5py/h5py.git && \
cd h5py && \
sed -i 's/1.19.3/1.20.1/g' setup.py && \
cd ..

# Install h5py from source
RUN pip install ./h5py
RUN pip install --no-cache-dir -r docker/arm64-darwin/requirements.txt
ENV PYTHONPATH "${PYTHONPATH}:/app"
ENTRYPOINT ["python3", "src/main.py"]
62 changes: 62 additions & 0 deletions docker/arm64-darwin/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
absl-py==2.1.0
astunparse==1.6.3
blinker==1.7.0
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
contourpy==1.2.1
cycler==0.12.1
dateparser==1.2.0
dm-tree==0.1.8
Flask==3.0.3
flatbuffers==24.3.25
fonttools==4.51.0
gast==0.5.4
google-pasta==0.2.0
grpcio==1.62.2
httmock==1.4.0
idna==3.7
itsdangerous==2.2.0
Jinja2==3.1.3
joblib==1.4.0
keras==3.0.5
keras-tuner==1.3.5
kiwisolver==1.4.5
kt-legacy==1.0.5
libclang==18.1.1
Markdown==3.6
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.7.1
mdurl==0.1.2
ml-dtypes==0.3.2
namex==0.0.8
numpy==1.23.5
opt-einsum==3.3.0
packaging==24.0
pandas==1.5.3
pillow==10.3.0
prometheus-api-client==0.5.4
protobuf==4.25.3
Pygments==2.17.2
pyparsing==3.1.2
python-dateutil==2.9.0.post0
pytz==2024.1
regex==2024.4.16
requests==2.31.0
rich==13.7.1
scikit-learn==1.2.2
scipy==1.13.0
six==1.16.0
tensorboard==2.16.2
tensorboard-data-server==0.7.2
tensorflow==2.16.1
tensorflow-io-gcs-filesystem==0.36.0
termcolor==2.4.0
threadpoolctl==3.4.0
tqdm==4.65.0
typing_extensions==4.11.0
tzlocal==5.2
urllib3==2.2.1
Werkzeug==3.0.2
wrapt==1.16.0

0 comments on commit aee30c6

Please sign in to comment.