mirror of
https://github.com/Balshgit/python-poetry.git
synced 2025-09-10 16:30:41 +03:00
add docker build instruction
This commit is contained in:
parent
51a7f5f578
commit
a328058a58
@ -51,4 +51,6 @@ RUN export PATH="/root/.local/bin:$PATH" \
|
|||||||
&& poetry lock \
|
&& poetry lock \
|
||||||
&& poetry export -f requirements.txt --without-hashes --output requirements.txt
|
&& poetry export -f requirements.txt --without-hashes --output requirements.txt
|
||||||
|
|
||||||
|
CMD [ "/bin/bash", "-c", "cp /code/* /poetry -r && chown ${USER}:$USER -R /poetry" ]
|
||||||
|
|
||||||
|
|
||||||
|
18
README.md
18
README.md
@ -2,18 +2,24 @@
|
|||||||
|
|
||||||
Used for poetry packages management with docker
|
Used for poetry packages management with docker
|
||||||
|
|
||||||
required `docker` and `docker-compose`
|
required `docker` and optionally `docker-compose`
|
||||||
|
|
||||||
|
|
||||||
## Poetry lock for any version
|
## Generate poetry lock for any version
|
||||||
|
|
||||||
- copy `pyproject.toml` file to poetry dir
|
- copy `pyproject.toml` file to `poetry` dir
|
||||||
- set `python` version the same as in `pyproject.toml` and set `poetry` versions in Dockerfile
|
- In Dockerfile set `python` version the same as in `pyproject.toml` and `poetry` version which will be used
|
||||||
|
|
||||||
run
|
|
||||||
|
|
||||||
|
### Run from docker:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build --build-arg USER=$USER -t poetry-python . && docker run --rm -u $USER -v $PWD/poetry:/poetry poetry-python
|
||||||
|
```
|
||||||
|
|
||||||
|
### Or from docker-compose:
|
||||||
```bash
|
```bash
|
||||||
docker-compose up --build
|
docker-compose up --build
|
||||||
```
|
```
|
||||||
|
|
||||||
script will generate `poetry.lock` and `requirements.txt` files
|
script will generate `poetry.lock` and `requirements.txt` files in `poetry` directory
|
@ -4,16 +4,11 @@ services:
|
|||||||
python:
|
python:
|
||||||
image: "poetry-python:latest"
|
image: "poetry-python:latest"
|
||||||
container_name: 'poetry-python'
|
container_name: 'poetry-python'
|
||||||
|
user: ${USER}
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
- USER=${USER}
|
- USER=${USER}
|
||||||
volumes:
|
volumes:
|
||||||
- ./poetry/:/poetry/
|
- ./poetry/:/poetry/
|
||||||
command: >
|
|
||||||
bash -c "
|
|
||||||
cp /code/* /poetry -r
|
|
||||||
&& sleep 2
|
|
||||||
&& chown ${USER}:$USER -R /poetry
|
|
||||||
"
|
|
Loading…
x
Reference in New Issue
Block a user