Skip to content

Commit 4542d9d

Browse files
ENH: adding docker files
1 parent 88f2798 commit 4542d9d

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

.dockerignore

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Python files
2+
__pycache__/
3+
*.pyc
4+
*.pyo
5+
*.pyd
6+
.Python
7+
db.sqlite3
8+
/db.sqlite3
9+
pip-log.txt
10+
pip-delete-this-directory.txt
11+
.pytest_cache/
12+
13+
# Documentation and Tests
14+
docs/
15+
.coverage
16+
readthedocs.yml
17+
.travis.yml
18+
Makefile
19+
20+
# Binary and Package files
21+
*.egg-info/
22+
*.egg
23+
dist/
24+
build/
25+
26+
# VCS
27+
.git/
28+
.gitignore
29+
.gitattributes
30+
.github/
31+
32+
# IDEs and Editors
33+
.vscode
34+
35+
# Virtual environments
36+
.venv
37+
venv
38+
ENV/
39+
env/
40+
41+
# Others
42+
*.log
43+
44+
# Docker
45+
Dockerfile
46+
.dockerignore

Dockerfile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Set base image
2+
# python:latest will get the latest version of python, on linux
3+
# Get a full list of python images here: https://hub.docker.com/_/python/tags
4+
FROM python:latest
5+
6+
# set the working directory in the container
7+
WORKDIR /RocketPy
8+
9+
# Ensure pip is updated
10+
RUN python3 -m pip install --upgrade pip
11+
12+
# Copy the dependencies file to the working directory
13+
COPY requirements.txt .
14+
COPY requirements-tests.txt .
15+
16+
# Install dependencies
17+
# Use a single RUN instruction to minimize the number of layers
18+
RUN pip install \
19+
-r requirements.txt \
20+
-r requirements-tests.txt
21+
22+
# copy the content of the local src directory to the working directory
23+
COPY . .
24+
25+
# command to run on container start
26+
# print the operational system and the python version
27+
CMD [ "python3", "-c", "import platform;import sys; print('Python ', sys.version, ' running on ', platform.platform())" ]
28+
29+
# Install the rocketpy package # TODO: check if I can put this in editable mode
30+
RUN pip install .

docker-compose.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3.8'
2+
3+
services:
4+
python38-linux:
5+
image: python:3.8
6+
volumes:
7+
- .:/app
8+
working_dir: /app
9+
command: bash -c "pip install . && pip install -r requirements-tests.txt && pytest && cd rocketpy && pytest --doctest-modules"
10+
logging:
11+
options:
12+
max-size: "10m"
13+
max-file: "3"
14+
15+
python312-linux:
16+
image: python:3.12
17+
volumes:
18+
- .:/app
19+
working_dir: /app
20+
command: bash -c "pip install . && pip install -r requirements-tests.txt && pytest && cd rocketpy && pytest --doctest-modules"
21+
logging:
22+
options:
23+
max-size: "10m"
24+
max-file: "3"

0 commit comments

Comments
 (0)