diff --git a/Makefile b/Makefile index d4a5f7dd37..489c8cfd70 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,6 @@ - -# tag?=latest # default - .PHONY: docker-up docker-up: ## start docker stack in foreground - docker compose up --build || true # --abort-on-container-exit + docker compose -f docker-compose.dev.yaml up --build || true # --abort-on-container-exit .PHONY: docker-push .ONESHELL: @@ -12,8 +9,10 @@ docker-push: ## build, tag, and push image to dockerhub. presumes you are logge @[ "$(tag)" = "" ] && (echo "Tag required. Example tag=1.2.3" ; exit 1) @image=$${username}/cypht:$(tag) @echo "Building image $${image}" - @docker buildx build . --platform linux/amd64 -t $${image} -f docker/Dockerfile --push + @docker buildx build . --platform linux/amd64 \ + -t $${image} -f docker/Dockerfile --push # TODO: build for arm architectures + # TODO: push docker/DOCKERHUB-README.md to dockerhub .PHONY: setup .ONESHELL: diff --git a/docker-compose.yaml b/docker-compose.dev.yaml similarity index 94% rename from docker-compose.yaml rename to docker-compose.dev.yaml index b8346b8db1..1bfe26b25c 100644 --- a/docker-compose.yaml +++ b/docker-compose.dev.yaml @@ -1,5 +1,5 @@ -# this file is used for development, not production +# this file should be used for development, not production services: db: diff --git a/docker/DOCKERHUB-README.md b/docker/DOCKERHUB-README.md new file mode 100644 index 0000000000..5f82894d20 --- /dev/null +++ b/docker/DOCKERHUB-README.md @@ -0,0 +1,40 @@ +# Cypht + +This is the official docker image of [Cypht](https://cypht.org/). + +## Features of this image + +* Alpine linux based image +* Bundled nginx and PHP 7 provides everything in one image +* Performs same install steps as found on [Cypht install page](https://cypht.org/install.html) +* All Cypht mods and configuration options can be set via environment variables +* Automatic database setup (if configured to use database) + +## Example docker-compose + +See example file here: +https://github.com/jonocodes/cypht/blob/docker-refresh/docker/docker-compose.yaml + +* Starts a database container to be for user authentication +* Starts the Cypht container available on port 80 of the host with ... + * A local volume declared for persisting user settings across container reboots + * An initial user account for authentication + * Environment variables for accessing the database container + +*NOTE: Please change usernames and passwords before using this docker-compose in your environment* + +## Environment variables + +See all the environment variables you can set here: +https://github.com/cypht-org/cypht/blob/master/.env.example + +It is recommended that in production you instead make a copy of this file: +``` +cp .env.example /etc/cypht-prod.env +``` + +Make changes to it and source it in to the docker-compose via 'env_file': +```yaml + env_file: + - /etc/cypht-prod.env +``` diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 7d943f5c0c..1a44f159ac 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -17,6 +17,8 @@ services: image: jonocodes/cypht:2.0.1-docker-wip ports: - "80:80" + # env_file: + # - /etc/cypht-prod.env environment: - AUTH_USERNAME=admin - AUTH_PASSWORD=admin