diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5ab74776a605295350c02febb92b8d87eadde5ff..bc2102881dc6bd477abdd5da41cd4aad7aff2202 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +1,9 @@ -# This file is a template, and might need editing before it works on your project. -# To contribute improvements to CI/CD templates, please follow the Development guide at: -# https://docs.gitlab.com/ee/development/cicd/templates.html +# This file is a modified template from GitLab CI/CD. # This specific template is located at: # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Docker.gitlab-ci.yml # Build a Docker image with CI/CD and push to the GitLab registry. # Docker-in-Docker documentation: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html -# -# This template uses one generic job with conditional builds -# for the default branch and all other (MR) branches. docker-build: # Use the official docker image. diff --git a/Dockerfile b/Dockerfile index 5d57d9632ef70afc22169aa075e2ac2741842510..97f0f7a87f5b1033a9113570eb0e16830419f914 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,5 +63,10 @@ RUN chown -R app:app $APP_HOME # change to the app user USER app -# run entrypoint.sh -ENTRYPOINT ["/home/app/web/entrypoint.sh"] \ No newline at end of file +# set the container start script to entrypoint.sh +ENTRYPOINT ["/home/app/web/entrypoint.sh"] + +# Expose the port the app runs on +EXPOSE 8000 + +# And we're done! diff --git a/README.md b/README.md index 2abf49400754458e91dc5f2748f637ff00855489..b591ebbff1a2953e9c9f1a07f0e13fcad24cf638 100644 --- a/README.md +++ b/README.md @@ -19,22 +19,24 @@ There is no demo server available at the moment, but you can run a demo locally ## Contributing -Contributions are always welcome! Fork the repo to another git service, make your changes, then drop me an email (`joe [at] radialbog9 [dot] uk`) or a discord message (`radialbog9`) so I can have a look! +Contributions are always welcome! Fork the repo to another git service, make your changes, then drop me an email (`joe[@]radialbog9[.]uk` without the square brackets) or a discord message (`radialbog9`) so I can have a look! +If you find a bug, you can email the following address to create an issue: `git[+]thejoecoder-heyheylibrary-28-issue-[@]rb9[.]xyz` (without the square brackets). ## Run Locally Install for development in a venv with Python: ```bash +# Clone the repo git clone https://git.rb9.xyz/TheJoeCoder/heyheylibrary cd heyheylibrary + +# Create the venv in the `venv` directory and install the requirements python -m venv venv ./venv/bin/python3 -m pip install -r requirements.txt -``` -Create the database: -```bash +# Create the database ./venv/bin/python manage.py migrate ``` @@ -58,7 +60,15 @@ ModuleNotFoundError: No module named 'pkg_resources' Refer to the [Django Wiki](https://docs.djangoproject.com/en/5.0/howto/deployment/) for deployment instructions. -Or, via docker: +There is also a docker image available at this repo: `registry.rb9.xyz/thejoecoder/heyheylibrary` + +The tags are as follows: +- `latest` - The latest version (NOT recommended!) +- A git branch name, e.g. `master` - The latest container built from that branch +- A git tag name, e.g. `v1.0.0` - The image built from that tag (recommended for production!) + +Additionally, a docker compose file is provided in the repo, which builds the app and runs it in a container. +Here's how to do that: ```bash # Clone the repo git clone https://git.rb9.xyz/TheJoeCoder/heyheylibrary diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index ca9b1d04cd2672411747fd85122b0a7a0738b7ec..2e5aa131683a9e0037504bff7817c0ab773a0f0e 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -44,7 +44,7 @@ services: - static_volume:/home/app/web/staticfiles - media_volume:/home/app/web/mediafiles ports: - - 1337:80 + - "1337:80" depends_on: - web