Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

Commit 528267f

Browse files
committed
Switch to building Ubuntu-based images
1 parent 8c09386 commit 528267f

File tree

4 files changed

+82
-51
lines changed

4 files changed

+82
-51
lines changed

.github/workflows/build-push.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ jobs:
4242
uses: docker/build-push-action@v4
4343
with:
4444
context: .
45-
build-args: FOAM_VERSION=${{ env.FOAM_VERSION }}
45+
build-args: |
46+
OS_VER=${{ env.FOAM_VERSION <= 2012 && '20.04' || '22.04'}}
47+
FOAM_VERSION=${{ env.FOAM_VERSION }}
4648
target: run
4749
platforms: linux/arm64
4850
load: true
@@ -56,7 +58,9 @@ jobs:
5658
uses: docker/build-push-action@v4
5759
with:
5860
context: .
59-
build-args: FOAM_VERSION=${{ env.FOAM_VERSION }}
61+
build-args: |
62+
OS_VER=${{ env.FOAM_VERSION <= 2012 && '20.04' || '22.04'}}
63+
FOAM_VERSION=${{ env.FOAM_VERSION }}
6064
target: dev
6165
platforms: linux/arm64
6266
load: true
@@ -70,7 +74,9 @@ jobs:
7074
uses: docker/build-push-action@v4
7175
with:
7276
context: .
73-
build-args: FOAM_VERSION=${{ env.FOAM_VERSION }}
77+
build-args: |
78+
OS_VER=${{ env.FOAM_VERSION <= 2012 && '20.04' || '22.04'}}
79+
FOAM_VERSION=${{ env.FOAM_VERSION }}
7480
target: default
7581
platforms: linux/arm64
7682
load: true

Dockerfile

Lines changed: 71 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,80 @@
1-
# syntax = edrevo/dockerfile-plus
1+
# ---------------------------------*-sh-*------------------------------------
2+
# Copyright (C) 2021-2022 OpenCFD Ltd.
3+
# Copyright (C) 2023 Gabriel Gerlero
4+
# SPDX-License-Identifier: (GPL-3.0+)
5+
#
6+
# Create openfoam '-run' image using Ubuntu.
7+
#
8+
# Example
9+
# docker build -f openfoam-run.Dockerfile .
10+
# docker build --build-arg OS_VER=impish --build-arg FOAM_VERSION=2212
11+
# -t opencfd/openfoam-run:2212 ...
12+
#
13+
# Note
14+
# Uses wget for fewer dependencies than curl
15+
#
16+
# ---------------------------------------------------------------------------
17+
ARG OS_VER=latest
218

3-
INCLUDE+ openfoam-run_leap.Dockerfile
19+
FROM ubuntu:${OS_VER} AS distro
20+
21+
# Version-independent base layer
22+
FROM distro AS base0
23+
ARG DEBIAN_FRONTEND=noninteractive
24+
25+
RUN apt-get update \
26+
&& apt-get -y install --no-install-recommends \
27+
apt-utils vim-tiny nano-tiny wget ca-certificates rsync \
28+
sudo passwd libnss-wrapper \
29+
&& rm -rf /var/lib/apt/lists/*
30+
31+
# Version-specific runtime layer
32+
FROM base0 AS runtime
33+
ARG FOAM_VERSION=2212
34+
ARG PACKAGE=openfoam${FOAM_VERSION}
35+
ARG DEBIAN_FRONTEND=noninteractive
36+
37+
RUN apt-get update \
38+
&& wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | bash \
39+
&& apt-get update \
40+
&& apt-get -y install --no-install-recommends ${PACKAGE} \
41+
&& rm -rf /var/lib/apt/lists/*
42+
43+
# ---------------
44+
# User management
45+
# - nss-wrapper
46+
# - openfoam sandbox directory
47+
48+
FROM runtime AS user
49+
COPY openfoam-files.rc/ /openfoam/
50+
RUN /bin/sh /openfoam/assets/post-install.sh -fix-perms
51+
52+
ENTRYPOINT [ "/openfoam/run" ]
53+
54+
# ---------------------------------------------------------------------------
455

5-
# run target: builds an 'openfoam-run' image
656
FROM user AS run
757

8-
# dev target: builds an 'openfoam-dev' image
58+
# ---------------------------------------------------------------------------
59+
960
FROM run AS dev
61+
ARG FOAM_VERSION
62+
ARG PACKAGE=openfoam${FOAM_VERSION}-dev
63+
ARG DEBIAN_FRONTEND=noninteractive
1064

11-
RUN zypper -n install -y ${PACKAGE}-devel \
12-
&& zypper -n clean
65+
RUN apt-get update \
66+
&& apt-get -y install --no-install-recommends ${PACKAGE} \
67+
&& rm -rf /var/lib/apt/lists/*
68+
69+
# ---------------------------------------------------------------------------
1370

14-
# default target: builds an 'openfoam-default' image
1571
FROM dev AS default
72+
ARG FOAM_VERSION
73+
ARG PACKAGE=openfoam${FOAM_VERSION}-default
74+
ARG DEBIAN_FRONTEND=noninteractive
75+
76+
RUN apt-get update \
77+
&& apt-get -y install --no-install-recommends ${PACKAGE} \
78+
&& rm -rf /var/lib/apt/lists/*
1679

17-
RUN zypper -n install -y ${PACKAGE}-default \
18-
&& zypper -n clean
80+
# ---------------------------------------------------------------------------

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
| ✨ OpenFOAM v2306 is now available (and will be used by default) |
44
| ---- |
5+
| **NOTE:** Docker images are now based on Ubuntu, to match the official (x86) images |
56

67
| 🖥 Using a Mac? If so, you may also want to check out my [native OpenFOAM builds for macOS.](https://github.com/gerlero/openfoam-app) |
78
| ---- |
@@ -55,7 +56,7 @@ The `-default` option requests a full environment (including the tutorial suite
5556

5657
## Details
5758

58-
ARM-based OpenFOAM environments are packaged in Docker images based on OpenSUSE Leap, using the official ARM binaries as recommended in the [OpenFOAM Docker FAQ](https://develop.openfoam.com/Development/openfoam/-/wikis/precompiled/docker#frequently-asked-questions). Note that this means that the base Linux distribution differs from the [official Docker images](https://hub.docker.com/u/opencfd), which use Ubuntu. The ARM-based Docker images are built here using GitHub Actions and uploaded to [Docker Hub](https://hub.docker.com/u/gerlero/). Dockerfiles and supporting files are based on those in the [official _packaging/containers_ repository](https://develop.openfoam.com/packaging/containers).
59+
Dockerfiles and supporting files are based on those in the [official _packaging/containers_ repository](https://develop.openfoam.com/packaging/containers). Images from this repo used to be based on OpenSUSE Leap, but have since switched to Ubuntu to match the [official x86 Docker images](https://hub.docker.com/u/opencfd), as official binaries are now available for Ubuntu on ARM.
5960

6061
## Legal notices
6162

openfoam-run_leap.Dockerfile

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)