Skip to content

Commit

Permalink
modified README and create run_docker command in Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
doridoro committed Sep 5, 2024
1 parent a8dbc1a commit 55cd385
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ pull_docker_image_python:
fi; \
docker pull "$$image:$$tag"

# run the pulled docker image locally
run_docker_image:
image="doridoro/oc_lettings_site"; \
tag=$$(curl -s "https://registry.hub.docker.com/v2/repositories/$$image/tags/" | python3 -c "import sys, json; print(max(json.load(sys.stdin)['results'], key=lambda x: x['last_updated'])['name'])"); \
if [ -z "$$tag" ]; then \
echo "Error: Failed to fetch Docker image tag."; \
exit 1; \
fi; \
docker run -e SECRET_KEY=secret -e ALLOWED_HOSTS='*' -e DEBUG=True -p 8000:8000 "$$image:$$tag" python manage.py collectstatic && gunicorn oc_lettings_site.wsgi:application

setup_install: setup_local_env install
virtual_linux_setup_install: virtual_env_linux setup_local_env install
virtual_windows_setup_install: virtual_env_windows setup_local_env install
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ issues you encounter.

Login to Docker Hub and pull the Latest Docker Image:

`$ make pull_docker_image`
`$ make pull_docker_image_python`

Verify the Pulled Image and get the ``TAG``:

`$ docker images`

Run the Docker Container and replace <tag> with ``TAG`` from command $ docker images:
Run the Docker Container:

`$ docker run -e SECRET_KEY=secret -p 8000:8000 doridoro/oc_lettings_site:<tag> python manage.py collectstatic && gunicorn oc_lettings_site.wsgi:application`
`$ make run_docker_image`

### Possibility 2: Clone the GitHub repository

Expand Down

0 comments on commit 55cd385

Please sign in to comment.