Skip to content

Commit

Permalink
MAINT: Add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jwboth committed Apr 10, 2024
1 parent 1adf8cd commit 6bef240
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This is the base Dockerfile for creating a DarSIA installation.
# The setup of the Docker image is under development and may change in the future.

# Base the Docker image on the official Python image.
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.12-slim

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

# Since using non-root users may lead to permission issues, we use root for now. See
# https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user for more.

ENV HOME /workdir
ENV DARSIA_HOME=${HOME}/darsia

# Create and move to code directory. This is where DarSIA will be installed.
WORKDIR ${HOME}

RUN apt-get update && \
# Install missing packages.
apt-get install -y git ffmpeg libsm6 libxext6 && \
# Fetch DarSIA from GitHub to code directory
git clone https://github.com/pmgbergen/DarSIA.git ${DARSIA_HOME}

# Move to DarSIA sub-directory
WORKDIR ${DARSIA_HOME}

# Update pip, install dependencies and freeze pip
RUN pip install --upgrade pip && \
pip install -e.[dev] && \
pip freeze && \
# Remove git
apt-get remove -y git python3-dev libssl-dev && \
apt-get autoremove -y

# Add DarSIA home to the pythonpath. This may or may not be necessary.
ENV PYTHONPATH $DARSIA_HOME:$PYTHONPATH

# Run tests to check that everything works.
# NOTE: When run as a GH action (presumably after a PR to the develop branch
# was accepted, e.g., when the tests have already been run on GH), this should
# only fail if the docker image itself is flawed.
WORKDIR ${DARSIA_HOME}/tests
RUN pytest
WORKDIR ${DARSIA_HOME}

0 comments on commit 6bef240

Please sign in to comment.