Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0af3a19
refactor: Update MAPDL Docker setup and documentation. Moved MAPDL do…
germa89 Aug 8, 2025
505625c
feat: Add Docker setup for PyMAPDL testing environment with Dockerfil…
germa89 Aug 11, 2025
a028637
feat: Enhance Docker setup and testing scripts for PyMAPDL with impro…
germa89 Aug 14, 2025
e31b2ed
refactor: Update docker-compose.yml to correct service name and remov…
germa89 Aug 14, 2025
dcac765
refactor: Update docker-compose.yml to standardize service name casing
germa89 Aug 14, 2025
8820345
refactor: Update Dockerfile and docker-compose.yml to improve configu…
germa89 Aug 14, 2025
4db251a
refactor: Update Dockerfile and docker-compose.yml for improved confi…
germa89 Aug 18, 2025
f11d019
feat: Add Dockerfile, docker-compose.yml, mylocal.ip, and start.sh fo…
germa89 Aug 19, 2025
1f1829b
chore: adding changelog file 4186.miscellaneous.md [dependabot-skip]
pyansys-ci-bot Aug 19, 2025
77afe05
Apply suggestions from code review
germa89 Aug 20, 2025
d1ceacf
fix: Correct spelling of MAPDL in documentation and comments
germa89 Aug 20, 2025
96dfea8
refactor: Clean up .gitignore by standardizing testing entries and re…
germa89 Aug 20, 2025
f81084a
docs: add testing env vars table.
germa89 Aug 20, 2025
b1d0667
Merge branch 'ci/adding-pymapdl-docker-image' of https://github.com/a…
germa89 Aug 20, 2025
af442f0
fix: Simplify comment in has_grpc function to clarify gRPC assumption
germa89 Aug 20, 2025
b23c26e
fix: Correct indentation in docker-compose.yml for default service
germa89 Aug 20, 2025
00f1d81
fix: Update docker-compose.yml to add missing comment for volume requ…
germa89 Aug 20, 2025
8a0a5d1
fix: Update environment variable vocabulary to include DMP and SMP
germa89 Aug 21, 2025
d3f1fc6
fix: Clarify message regarding insufficient licenses for MAPDL startup
germa89 Aug 21, 2025
7cc6667
Merge branch 'main' into ci/adding-pymapdl-docker-image
clatapie Oct 8, 2025
b200507
chore: adding changelog file 4186.maintenance.md [dependabot-skip]
pyansys-ci-bot Oct 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/getting_started/make_container.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.. _ref_make_container:

.. include:: ../../../docker/make_container.rst
.. include:: ../../../docker/MAPDL/make_container.rst
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Requirements

* The following provided files:

* `Dockerfile <https://github.com/ansys/pymapdl/tree/main/docker/Dockerfile>`_
* `.dockerignore <https://github.com/ansys/pymapdl/tree/main/docker/.dockerignore>`_
* `Dockerfile <https://github.com/ansys/pymapdl/tree/main/docker/MAPDL/Dockerfile>`_
* `.dockerignore <https://github.com/ansys/pymapdl/tree/main/docker/MAPDL/.dockerignore>`_


Procedure
Expand Down Expand Up @@ -100,10 +100,10 @@ Please notice that:
* ``path_to_mapdl_installation`` is the path to where you have locally installed ANSYS MAPDL.

Not all the installation files are copied, in fact, the files ignored during the copying
are detailed in the file `.dockerignore <https://github.com/ansys/pymapdl/tree/main/docker/.dockerignore>`_.
are detailed in the file `.dockerignore <https://github.com/ansys/pymapdl/tree/main/docker/MAPDL/.dockerignore>`_.

The Docker container configuration needed to build the container is detailed in the
`Dockerfile <https://github.com/ansys/pymapdl/tree/main/docker/Dockerfile>`_.
`Dockerfile <https://github.com/ansys/pymapdl/tree/main/docker/MAPDL/Dockerfile>`_.


Summary
Expand Down
217 changes: 217 additions & 0 deletions docker/testing/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
# PyMAPDL docker image that runs the tests.

# Dummy default so there is no error if not set.
# It needs to be set here because we are using it
# later on the FROM.
ARG DOCKER_IMAGE=mapdl:latest

#######################################################
FROM ubuntu:22.04 AS python-main
#######################################################

ARG USE_LOCAL_REPO=yes
ARG PYTHON_VERSION=3.11

ENV USE_LOCAL_REPO=${USE_LOCAL_REPO}

# Set workdir
WORKDIR /workspace

# Install system dependencies
RUN apt-get update && \
apt-get install -y \
libgl1-mesa-glx \
xvfb \
libgomp1 \
graphviz \
git \
openssh-client

# Clone to install the libraries needed
RUN git clone https://github.com/ansys/pymapdl.git .

RUN apt-get update && apt install -y \
python${PYTHON_VERSION}-venv \
python3-pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Upgrade pip and install test dependencies
RUN \
python${PYTHON_VERSION} -m pip install --upgrade pip && \
pip install .[tests]

# Configuration
# -------------
# Variable for running as if it were on CICD while testing
ENV ON_CI=True
# Tu simulate running on local machine
ENV ON_LOCAL=False
# For tests that check if running on ubuntu.
ENV ON_UBUNTU=False
# Some tests check if running on student machines
ENV ON_STUDENT=False

# PyMAPDL testing env vars
# ------------------------
# To work without a screen.
ENV PYANSYS_OFF_SCREEN=True
# Enable debugging for PyMAPDL
ENV PYMAPDL_DEBUG_TESTING=True
# To connect to an already alive or remote MAPDL instance
ENV PYMAPDL_START_INSTANCE=False
# Set MAPDL port to connect to
ENV PYMAPDL_PORT=50052

# DPF testing
# -----------
# Not testing against DPF
#
# To connect to a remote DPF server
ENV DPF_START_SERVER=False
# Simulate not having DPF
ENV HAS_DPF=False
# Not testing DPF-Results backend
ENV TEST_DPF_BACKEND=False
# MAPDL and DPF are running on the same container
ENV ON_SAME_CONTAINER=False

# Pytest settings
# ---------------
ENV PYTEST_ARGUMENTS="-vvv -ra --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests --strict-markers"

# Setting entrypoint
# ------------------
COPY start.sh /
RUN chmod +x /start.sh

EXPOSE 50052

RUN git config --global --add safe.directory /workspace/pymapdl

CMD [ "/bin/bash", "/start.sh" ]

#######################################################
FROM python-main AS test-clone-pymapdl
#######################################################

ENV USE_LOCAL_REPO=false

#######################################################
FROM python-main AS test-local-pymapdl
#######################################################

ENV USE_LOCAL_REPO=true

# Remove cloned repo so the local repo can be mounted.
RUN $(rm -rf *) >/dev/null 2>&1

#######################################################
FROM ubuntu:22.04 AS mapdl-local
#######################################################

ARG USERNAME=mapdl
ARG USER_UID=1000
ARG USER_GID=$USER_UID

ENV DEBIAN_FRONTEND=noninteractive
ENV USERNAME=$USERNAME

# OS configuration
# ----------------
# Installing dependencies
RUN apt-get update && \
apt-get install -y \
libgomp1 \
libgl1 \
libglu1 \
libxm4 \
libxi6 \
openssh-client \
&& apt install -y software-properties-common \
&& add-apt-repository -y ppa:zeehio/libxp \
&& apt-get update \
&& apt-get install -y libxp6 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

#######################################################
FROM ${DOCKER_IMAGE} AS mapdl-local-container-pymapdl
#######################################################
#
# WARNING: This container is designed to work using an Ubuntu base image.
#
ARG PYTHON_VERSION=3.11

# OS configuration
# ----------------
# Installing dependencies
RUN apt-get update && \
apt-get install -y \
libgl1-mesa-glx \
xvfb \
libgomp1 \
graphviz \
git \
openssh-client

# Clone to install the libraries needed
RUN git clone https://github.com/ansys/pymapdl.git .

RUN python3 --version || (apt-get update && apt install -y \
python${PYTHON_VERSION}-venv \
python3-pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*)

# Upgrade pip and install test dependencies
RUN \
python3 -m pip install --upgrade pip && \
pip install .[tests]

# Configuration
# -------------
# Variable for running as if it were on CICD while testing
ENV ON_CI=True
# Tu simulate running on local machine
ENV ON_LOCAL=True
# For tests that check if running on ubuntu.
ENV ON_UBUNTU=False
# Some tests check if running on student machines
ENV ON_STUDENT=False

# PyMAPDL testing env vars
# ------------------------
# To work without a screen.
ENV PYANSYS_OFF_SCREEN=True
# Enable debugging for PyMAPDL
ENV PYMAPDL_DEBUG_TESTING=True
# To connect to an already alive or remote MAPDL instance
ENV PYMAPDL_START_INSTANCE=False
# Set MAPDL port to connect to
ENV PYMAPDL_PORT=50052

# DPF testing
# -----------
# Not testing against DPF
#
# To connect to a remote DPF server
ENV DPF_START_SERVER=False
# Simulate not having DPF
ENV HAS_DPF=False
# Not testing DPF-Results backend
ENV TEST_DPF_BACKEND=False
# MAPDL and DPF are running on the same container
ENV ON_SAME_CONTAINER=False

# Pytest settings
# ---------------
ENV PYTEST_ARGUMENTS='-vvv -ra --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests --strict-markers'

# Setting entrypoint
# ------------------
COPY start.sh /
RUN chmod +x /start.sh

EXPOSE 50052

CMD [ "/bin/bash", "/start.sh" ]
Loading
Loading