Skip to content

Commit dcca278

Browse files
committed
add docker test, arm64
1 parent d48b43f commit dcca278

File tree

2 files changed

+139
-0
lines changed

2 files changed

+139
-0
lines changed

.github/workflows/docker_test.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# this tests that the latest docker image works, and does linter checks
2+
# linter checks happen here because docker images are faster than waiting for
3+
# dependencies to install on GitHub Actions VMs
4+
on: [push, pull_request]
5+
6+
name: Docker Tests
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Set up Docker Buildx
13+
uses: docker/setup-buildx-action@v3
14+
- name: Login to Docker Hub
15+
uses: docker/login-action@v3
16+
with:
17+
username: ${{ secrets.DOCKERHUB_USERNAME }}
18+
password: ${{ secrets.DOCKERHUB_TOKEN }}
19+
- name: Build and push
20+
uses: docker/build-push-action@v6
21+
with:
22+
platforms: linux/amd64,linux/arm64
23+
push: false
24+
tags: mwatelescope/hyperbeam:latest
25+
cache-from: type=gha
26+
cache-to: type=gha,mode=max
27+
check:
28+
name: Docker Test and Release
29+
needs: build
30+
runs-on: ubuntu-latest
31+
container: mwatelescope/hyperbeam:latest
32+
steps:
33+
- name: Checkout sources
34+
uses: actions/checkout@v3
35+
with:
36+
fetch-depth: 0
37+
- run: /opt/cargo/bin/cargo check
38+
- run: /opt/cargo/bin/cargo fmt --all -- --check
39+
- run: /opt/cargo/bin/cargo clippy --all-targets --all-features -- -D warnings
40+
- run: /opt/cargo/bin/cargo test --release
41+
- run: /opt/cargo/bin/cargo test --no-default-features --release --features=cli
42+
push:
43+
needs: build # TODO: needs: check
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v3
48+
- name: Login to Docker Hub
49+
uses: docker/login-action@v3
50+
with:
51+
username: ${{ secrets.DOCKERHUB_USERNAME }}
52+
password: ${{ secrets.DOCKERHUB_TOKEN }}
53+
- name: Build and push
54+
uses: docker/build-push-action@v6
55+
with:
56+
platforms: linux/amd64,linux/arm64
57+
push: true
58+
tags: mwatelescope/hyperbeam:latest
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# syntax=docker/dockerfile:1
2+
# cross-platform, cpu-only dockerfile for demoing MWA software stack
3+
# on amd64, arm64
4+
# ref: https://docs.docker.com/build/building/multi-platform/
5+
# ARG BASE_IMG="ubuntu:20.04"
6+
# HACK: newer python breaks on old ubuntu
7+
ARG BASE_IMG="python:3.11-bookworm"
8+
FROM ${BASE_IMG} as base
9+
10+
# Suppress perl locale errors
11+
ENV LC_ALL=C
12+
RUN apt-get update && \
13+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
14+
build-essential \
15+
ca-certificates \
16+
clang \
17+
cmake \
18+
curl \
19+
cython3 \
20+
fontconfig \
21+
g++ \
22+
git \
23+
ipython3 \
24+
jq \
25+
lcov \
26+
libcfitsio-dev \
27+
liberfa-dev \
28+
libhdf5-dev \
29+
libpng-dev \
30+
libpython3-dev \
31+
pkg-config \
32+
procps \
33+
python3 \
34+
python3-dev \
35+
python3-pip \
36+
python3-wheel \
37+
python3-importlib-metadata \
38+
tzdata \
39+
unzip \
40+
wget \
41+
zip \
42+
&& \
43+
apt-get clean all && \
44+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
45+
apt-get -y autoremove
46+
47+
# Get Rust
48+
ARG RUST_VERSION=stable
49+
ENV RUSTUP_HOME=/opt/rust CARGO_HOME=/opt/cargo PATH="/opt/cargo/bin:${PATH}"
50+
RUN mkdir -m755 $RUSTUP_HOME $CARGO_HOME && ( \
51+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | env RUSTUP_HOME=$RUSTUP_HOME CARGO_HOME=$CARGO_HOME sh -s -- -y \
52+
--profile=minimal \
53+
--default-toolchain=${RUST_VERSION} \
54+
)
55+
56+
# install python prerequisites
57+
# - newer pip needed for mwalib maturin install
58+
# - other versions pinned to avoid issues with numpy==2
59+
ARG SSINS_BRANCH=master
60+
ARG MWAQA_BRANCH=dev
61+
RUN python -m pip install --no-cache-dir \
62+
importlib_metadata==8.2.0 \
63+
maturin[patchelf]==1.7.0 \
64+
pip==24.2 \
65+
;
66+
67+
ARG MWALIB_BRANCH=v1.5.0
68+
RUN git clone --depth 1 --branch=${MWALIB_BRANCH} https://github.com/MWATelescope/mwalib.git /mwalib && \
69+
cd /mwalib && \
70+
maturin build --release --features=python && \
71+
python -m pip install $(ls -1 target/wheels/*.whl | tail -n 1) && \
72+
cd / && \
73+
rm -rf /mwalib ${CARGO_HOME}/registry
74+
75+
ADD . /app
76+
WORKDIR /app
77+
RUN maturin build --release --features=python && \
78+
python -m pip install $(ls -1 target/wheels/*.whl | tail -n 1) && \
79+
rm -rf ${CARGO_HOME}/registry

0 commit comments

Comments
 (0)