https://github.com/pythoninthegrass/john_dockerfile
john_dockerfile
https://github.com/pythoninthegrass/john_dockerfile
Last synced: about 1 year ago
JSON representation
john_dockerfile
- Host: GitHub
- URL: https://github.com/pythoninthegrass/john_dockerfile
- Owner: pythoninthegrass
- Created: 2023-01-25T03:23:09.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-25T03:31:48.000Z (about 3 years ago)
- Last Synced: 2025-01-11T16:50:27.950Z (about 1 year ago)
- Language: Dockerfile
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# john_dockerfile
Hi John!
While I don't have the bandwidth to make a django demo repo, figured a short and sweet POC would suffice. Copied some docs from my [python_template](https://github.com/pythoninthegrass/python_template) repo for your reference. ~~(Did add a django folder as well, but it's been a bit since I've tested it haha.)~~
Two commands to get it working with just docker:
```
λ docker build -t john-docker .
λ docker run -it --rm -v $(PWD):/app john-docker bash
app@a02770ca0530:/app$ ls -l
total 20
-rw-r--r-- 1 app app 529 Jan 25 03:02 Dockerfile
-rw-r--r-- 1 app app 0 Jan 25 02:50 README.md
-rwxr-xr-x 1 app app 519 Jan 25 03:08 hello.py
-rw-r--r-- 1 app app 3733 Jan 25 03:07 poetry.lock
-rw-r--r-- 1 app app 395 Jan 25 03:07 pyproject.toml
-rw-r--r-- 1 app app 1 Jan 25 03:06 requirements.txt
```
Turns out the [django example](django/) _does_ work! 🥳
```bash
# move to django directory
cd django
# build without cached layers and concurrently (useless without multistage, but hey)
docker-compose build --no-cache --parallel
# start container(s) and get rid of orphaned builds
docker-compose up --remove-orphans -d
# navigate to localhost:8000
# remove
docker-compose down # stop is another option
```