Add docker-compoose support, using docker-compose run application

This commit is contained in:
Daniel_I_Am 2022-02-08 19:33:35 +01:00
parent 94ad020983
commit f5bc158b14
2 changed files with 28 additions and 0 deletions

13
docker-compose.yml Normal file
View File

@ -0,0 +1,13 @@
# docker run --rm -v $(pwd):/code -w /code -u $(id -u) -it python:3.10 bash
version: "3.8"
services:
application:
image: python:3.10
volumes:
- .:/code
working_dir: /code
entrypoint: /code/entrypoint.sh
tty: true

15
entrypoint.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
if [ ! -e env/bin/activate ]
then
python -m venv env
fi
if [ "$#" -gt 0 ]
then
bash --rcfile <(cat env/bin/activate) -c -- "$@"
else
bash --rcfile <(cat env/bin/activate)
fi