-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Provide files for building a Docker image
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|