Skip to content

Commit bba9eed

Browse files
committed
New Docker Image & Docker CI
1 parent 480429b commit bba9eed

File tree

3 files changed

+44
-57
lines changed

3 files changed

+44
-57
lines changed

.github/workflows/docker.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Docker Image Publisher
1+
name: Docker Publisher
22

33
on:
44
push:
5-
branches: [ "GPU" ]
5+
branches: [ "master" ]
66
paths:
7-
- Dockerfile
7+
- toolchain/Dockerfile
88

99
workflow_dispatch:
1010

@@ -16,14 +16,15 @@ jobs:
1616
- uses: actions/checkout@v3
1717

1818
- name: Login to Docker Hub
19-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
19+
uses: docker/login-action@v2
2020
with:
2121
username: ${{ secrets.DOCKER_USERNAME }}
2222
password: ${{ secrets.DOCKER_PASSWORD }}
2323

24-
- name: Build and push Docker image
25-
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
24+
- name: Build & Publish thereto
25+
uses: docker/build-push-action@v4
2626
with:
2727
file: toolchain/Dockerfile
2828
push: true
29-
tags: henryleberre/mfc:latest
29+
tags: ${{ secrets.DOCKER_USERNAME }}/mfc:latest
30+

mfc.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,27 @@ elif [ "$1" == "docker" ]; then
176176
fi
177177

178178
log "Running in$MAGENTA Docker$COLOR_RESET mode."
179-
log " - Fetching image..."
180-
if ! docker pull henryleberre/mfc; then
181-
error "Failed to fetch$MAGENTA Docker$COLOR_RESET image from$MAGENTA Docker Hub$COLOR_RESET."
179+
180+
if [ -t 1 ]; then
181+
dockerintopts='--interactive --tty'
182+
fi
183+
184+
__docker_run() {
185+
docker run $dockerintopts --rm --workdir /home/me/MFC \
186+
--mount type=bind,source="$(pwd)",target=/home/me/MFC \
187+
sbryngelson/mfc:latest $@
188+
}
189+
190+
__docker_run sudo chown -R me:me /home/me/MFC
191+
if (($?)); then
192+
error "Docker: Failed to set directory permissions on MFC mount.."
182193

183194
exit 1
184195
fi
185196

186-
log " - Starting container..."
187-
docker run --interactive --tty --rm \
188-
--mount type=bind,source="$(pwd)",target=/home/me/MFC \
189-
henryleberre/mfc
197+
__docker_run $@
190198
if (($?)); then
191-
error "Failed to start Docker container."
199+
error "Error running Docker container with $@."
192200

193201
exit 1
194202
fi

toolchain/Dockerfile

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,24 @@
1-
FROM archlinux:latest
2-
3-
# Install packages/dependencies
4-
RUN pacman-key --init
5-
RUN pacman -Syyu --noconfirm
6-
RUN pacman -S --noconfirm \
7-
base-devel coreutils \
8-
git ninja gcc-fortran \
9-
cmake openmpi python3 \
10-
python-pip openssh \
11-
python-virtualenv vim \
12-
wget tree
13-
14-
# Generic (non-root) user because MPI dislikes running as root.
15-
# This user is allowed to run "sudo" commands without a password.
16-
RUN useradd --create-home --shell /bin/bash me
17-
RUN passwd -d me
18-
RUN echo "me ALL=(ALL:ALL) ALL" >> /etc/sudoers
19-
USER me
20-
WORKDIR /home/me
21-
22-
# Env
1+
FROM ubuntu:jammy
2+
MAINTAINER Henry Le Berre <[email protected]>
3+
234
ENV PS1='[\u@mfc] \e[1;32m\w\e[0m \$ '
245
ENV CMAKE_GENERATOR=Ninja
256

26-
# Bashrc
27-
RUN echo $' \
28-
export PS1="[\u@mfc] \e[1;32m\w\e[0m \$ " \n\
29-
echo " " \n\
30-
echo " Welcome to the MFC Docker Environment!" \n\
31-
echo " " \n\
32-
if [ -d "/home/me/MFC" ]; then \n\
33-
echo " Please wait a few seconds while MFC configures directory permissions." \n\
34-
echo " > sudo chown -R me:me /home/me/MFC" \n\
35-
sudo chown -R me:me /home/me/MFC \n\
36-
echo " > Complete." \n\
37-
echo " Follow the README\'s instructions to get started with MFC." \n\
38-
else \n\
39-
echo " Error: The MFC mount isn\'t available." \n\
40-
fi \n\
41-
echo "" \n\
42-
cd /home/me/MFC \n\
43-
' >> /home/me/.bashrc
44-
45-
# Run bash as the default command
7+
RUN apt update && apt upgrade -y
8+
9+
RUN apt install -y git tar wget make cmake ninja-build gcc g++ \
10+
python3 python3-dev python3-pip python3-venv \
11+
'openmpi-*' libopenmpi-dev sudo vim nano \
12+
hdf5-tools
13+
14+
RUN groupadd --gid 1000 me && \
15+
useradd --uid 1000 --gid 1000 -m me
16+
17+
RUN echo me ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/me && \
18+
chmod 0440 /etc/sudoers.d/me
19+
20+
USER me
21+
22+
RUN pip3 install fypp rich pyyaml
23+
4624
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)