Skip to content

Commit

Permalink
ENH: adding docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gui-FernandesBR committed Oct 29, 2023
1 parent 88f2798 commit 4542d9d
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Python files
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
db.sqlite3
/db.sqlite3
pip-log.txt
pip-delete-this-directory.txt
.pytest_cache/

# Documentation and Tests
docs/
.coverage
readthedocs.yml
.travis.yml
Makefile

# Binary and Package files
*.egg-info/
*.egg
dist/
build/

# VCS
.git/
.gitignore
.gitattributes
.github/

# IDEs and Editors
.vscode

# Virtual environments
.venv
venv
ENV/
env/

# Others
*.log

# Docker
Dockerfile
.dockerignore
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Set base image
# python:latest will get the latest version of python, on linux
# Get a full list of python images here: https://hub.docker.com/_/python/tags
FROM python:latest

# set the working directory in the container
WORKDIR /RocketPy

# Ensure pip is updated
RUN python3 -m pip install --upgrade pip

# Copy the dependencies file to the working directory
COPY requirements.txt .
COPY requirements-tests.txt .

# Install dependencies
# Use a single RUN instruction to minimize the number of layers
RUN pip install \
-r requirements.txt \
-r requirements-tests.txt

# copy the content of the local src directory to the working directory
COPY . .

# command to run on container start
# print the operational system and the python version
CMD [ "python3", "-c", "import platform;import sys; print('Python ', sys.version, ' running on ', platform.platform())" ]

# Install the rocketpy package # TODO: check if I can put this in editable mode
RUN pip install .
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.8'

services:
python38-linux:
image: python:3.8
volumes:
- .:/app
working_dir: /app
command: bash -c "pip install . && pip install -r requirements-tests.txt && pytest && cd rocketpy && pytest --doctest-modules"
logging:
options:
max-size: "10m"
max-file: "3"

python312-linux:
image: python:3.12
volumes:
- .:/app
working_dir: /app
command: bash -c "pip install . && pip install -r requirements-tests.txt && pytest && cd rocketpy && pytest --doctest-modules"
logging:
options:
max-size: "10m"
max-file: "3"

0 comments on commit 4542d9d

Please sign in to comment.