Skip to content

Commit

Permalink
chore: Provide files for building a Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjanus committed Sep 16, 2024
1 parent 00099ee commit f7f5a20
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# syntax=docker/dockerfile:1

# reemission requires python version 3.10 and higher
ARG PYTHON_VERSION=3.10.12
FROM python:${PYTHON_VERSION}-slim AS base

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

# Create a non-privileged user that the app will run under.
RUN useradd --create-home --shell /bin/bash appuser

# Switch to the non-privileged user to run the application.
USER appuser

# Create a folder for RE-Emission
RUN mkdir -p /home/appuser/reemission
WORKDIR /home/appuser/reemission

# Copy the source code into the container.
COPY --chown=appuser:appuser . .

# Add both /home/appuser/.local/bin and /usr/local/bin to PATH
ENV PATH="/home/appuser/.local/bin:/usr/local/bin:$PATH"

# Install the package and all its dependencies in editable mode
RUN pip install --upgrade pip && pip install -e .

COPY docker_entrypoint.sh ./docker_entrypoint.sh

RUN echo $PATH

# Execute the user-specified command line arguments.
ENTRYPOINT [ "/bin/bash", "./docker_entrypoint.sh"]

# Default command if no arguments supplied
CMD []
1 change: 1 addition & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
""" """
10 changes: 10 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
reemission:
build:
context: .
image: reemission_image
volumes:
- ./examples:/home/appuser/reemission/examples
- ./outputs:/home/appuser/reemission/outputs
stdin_open: true
tty: true
11 changes: 11 additions & 0 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# docker_entrypoint.sh

# If no arguments are passed, run the default command (reemission)
if [ -z "$1" ]; then
exec reemission "$@"
else
# Otherwise, run the provided command
exec "$@"
fi

0 comments on commit f7f5a20

Please sign in to comment.