Docker add healthcheck and mention Docker Hub image
This commit is contained in:
		
							parent
							
								
									0f524955b2
								
							
						
					
					
						commit
						38ac3e42be
					
				
					 5 changed files with 42 additions and 29 deletions
				
			
		|  | @ -53,10 +53,10 @@ LABEL org.opencontainers.image.created=${CREATED} \ | ||||||
|       org.opencontainers.image.url="https://conduit.rs/" \ |       org.opencontainers.image.url="https://conduit.rs/" \ | ||||||
|       org.opencontainers.image.revision=${GIT_REF} \ |       org.opencontainers.image.revision=${GIT_REF} \ | ||||||
|       org.opencontainers.image.source="https://git.koesters.xyz/timo/conduit.git" \ |       org.opencontainers.image.source="https://git.koesters.xyz/timo/conduit.git" \ | ||||||
|       org.opencontainers.image.documentation.="" \ |  | ||||||
|       org.opencontainers.image.licenses="AGPL-3.0-only" \ |       org.opencontainers.image.licenses="AGPL-3.0-only" \ | ||||||
|  |       org.opencontainers.image.documentation="" \ | ||||||
|       org.opencontainers.image.ref.name="" \ |       org.opencontainers.image.ref.name="" \ | ||||||
|       org.label-schema.docker.build="docker build . -t conduit_homeserver:latest --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)" \ |       org.label-schema.docker.build="docker build . -t matrixconduit/matrix-conduit:latest --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)" \ | ||||||
|       maintainer="Weasy666" |       maintainer="Weasy666" | ||||||
| 
 | 
 | ||||||
| # Standard port on which Rocket launches | # Standard port on which Rocket launches | ||||||
|  | @ -81,11 +81,15 @@ RUN chown -cR www-data:www-data /srv/conduit | ||||||
| # Install packages needed to run Conduit | # Install packages needed to run Conduit | ||||||
| RUN apk add --no-cache \ | RUN apk add --no-cache \ | ||||||
|         ca-certificates \ |         ca-certificates \ | ||||||
|  |         curl \ | ||||||
|         libgcc |         libgcc | ||||||
| 
 | 
 | ||||||
| # Create a volume for the database, to persist its contents | # Create a volume for the database, to persist its contents | ||||||
| VOLUME ["/srv/conduit/.local/share/conduit"] | VOLUME ["/srv/conduit/.local/share/conduit"] | ||||||
| 
 | 
 | ||||||
|  | # Test if Conduit is still alive, uses the same endpoint as Element | ||||||
|  | HEALTHCHECK --start-period=2s CMD curl --fail -s http://localhost:8000/_matrix/client/versions || curl -k --fail -s https://localhost:8000/_matrix/client/versions || exit 1 | ||||||
|  | 
 | ||||||
| # Set user to www-data | # Set user to www-data | ||||||
| USER www-data | USER www-data | ||||||
| # Set container home directory | # Set container home directory | ||||||
|  |  | ||||||
|  | @ -25,7 +25,14 @@ Clone the repo, build it with `cargo build --release` and call the binary | ||||||
| 
 | 
 | ||||||
| ##### Using Docker | ##### Using Docker | ||||||
| 
 | 
 | ||||||
| Build the docker image and run it with docker or docker-compose. [Read more](docker/README.md) | Pull and run the docker image with | ||||||
|  | 
 | ||||||
|  | ``` bash | ||||||
|  | docker pull matrixconduit/matrix-conduit:latest | ||||||
|  | docker run -d matrixconduit/matrix-conduit:latest -p 8448:8000 -v db:/srv/conduit/.local/share/conduit | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Or build and run it with docker or docker-compose. [Read more](docker/README.md) | ||||||
| 
 | 
 | ||||||
| #### What is it build on? | #### What is it build on? | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,18 +3,19 @@ version: '3' | ||||||
| 
 | 
 | ||||||
| services: | services: | ||||||
|     homeserver: |     homeserver: | ||||||
|         ### If you already built the Conduit image with 'docker build', then you can uncomment the |         ### If you already built the Conduit image with 'docker build' or want to use the Docker Hub image, | ||||||
|         ### 'image' line and comment out the 'build' option. |         ### then you are ready to go. | ||||||
|         # image: conduit_homeserver:latest |         image: matrixconduit/matrix-conduit:latest | ||||||
|         ### If you want meaningful labels in you built Conduit image, you should run docker-compose like this: |         ### If you want to build a fresh image from the sources, then comment the image line and uncomment the | ||||||
|  |         ### build lines. If you want meaningful labels in your built Conduit image, you should run docker-compose like this: | ||||||
|         ### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d |         ### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d | ||||||
|         build: |         # build: | ||||||
|             context: . |         #     context: . | ||||||
|             args: |         #     args: | ||||||
|                 CREATED: |         #         CREATED: | ||||||
|                 VERSION: |         #         VERSION: | ||||||
|                 LOCAL: "false" |         #         LOCAL: 'false' | ||||||
|                 GIT_REF: HEAD |         #         GIT_REF: HEAD | ||||||
|         restart: unless-stopped |         restart: unless-stopped | ||||||
|         ports: |         ports: | ||||||
|             - 8448:8000 |             - 8448:8000 | ||||||
|  |  | ||||||
|  | @ -28,10 +28,10 @@ ARG GIT_REF=HEAD | ||||||
| To build the image you can use the following command | To build the image you can use the following command | ||||||
| 
 | 
 | ||||||
| ``` bash | ``` bash | ||||||
| docker build . -t conduit_homeserver:latest --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) | docker build . -t matrixconduit/matrix-conduit:latest --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| which also will tag the resulting image as `conduit_homeserver:latest`. | which also will tag the resulting image as `matrixconduit/matrix-conduit:latest`. | ||||||
| **Note:** it ommits the two optional `build-arg`s. | **Note:** it ommits the two optional `build-arg`s. | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -40,7 +40,7 @@ which also will tag the resulting image as `conduit_homeserver:latest`. | ||||||
| After building the image you can simply run it with | After building the image you can simply run it with | ||||||
| 
 | 
 | ||||||
| ``` bash | ``` bash | ||||||
| docker run conduit_homeserver:latest -p 8448:8000 -v db:/srv/conduit/.local/share/conduit -e ROCKET_SERVER_NAME="localhost:8000" | docker run -d matrixconduit/matrix-conduit:latest -p 8448:8000 -v db:/srv/conduit/.local/share/conduit -e ROCKET_SERVER_NAME="localhost:8000" | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| For detached mode, you also need to use the `-d` flag. You can pass in more env vars as are shown here, for an overview of possible values, you can take a look at the `docker-compose.yml` file. | For detached mode, you also need to use the `-d` flag. You can pass in more env vars as are shown here, for an overview of possible values, you can take a look at the `docker-compose.yml` file. | ||||||
|  | @ -49,7 +49,7 @@ If you just want to test Conduit for a short time, you can use the `--rm` flag, | ||||||
| 
 | 
 | ||||||
| ## Docker-compose | ## Docker-compose | ||||||
| 
 | 
 | ||||||
| If the docker command is not for you or your setup, you can also use one of the provided `docker-compose` files. Depending on your proxy setup, use the `docker-compose.traefik.yml` including `docker-compose.override.traefik.yml` or the normal `docker-compose.yml` for every other reverse proxy. | If the docker command is not for you or your setup, you can also use one of the provided `docker-compose` files. Depending on your proxy setup, use the [`docker-compose.traefik.yml`](docker-compose.traefik.yml) including [`docker-compose.override.traefik.yml`](docker-compose.override.traefik.yml) or the normal [`docker-compose.yml`](../docker-compose.yml) for every other reverse proxy. | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| ### Build | ### Build | ||||||
|  |  | ||||||
|  | @ -3,18 +3,19 @@ version: '3' | ||||||
| 
 | 
 | ||||||
| services: | services: | ||||||
|     homeserver: |     homeserver: | ||||||
|         ### If you already built the Conduit image with 'docker build', then you can uncomment the |         ### If you already built the Conduit image with 'docker build' or want to use the Docker Hub image, | ||||||
|         ### 'image' line and comment out the 'build' option. |         ### then you are ready to go. | ||||||
|         # image: conduit_homeserver:latest |         image: matrixconduit/matrix-conduit:latest | ||||||
|         ### If you want meaningful labels in you built Conduit image, you should run docker-compose like this: |         ### If you want to build a fresh image from the sources, then comment the image line and uncomment the | ||||||
|  |         ### build lines. If you want meaningful labels in your built Conduit image, you should run docker-compose like this: | ||||||
|         ### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d |         ### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d | ||||||
|         build: |         # build: | ||||||
|             context: . |         #     context: . | ||||||
|             args: |         #     args: | ||||||
|                 CREATED: |         #         CREATED: | ||||||
|                 VERSION: |         #         VERSION: | ||||||
|                 LOCAL: false |         #         LOCAL: 'false' | ||||||
|                 GIT_REF: HEAD |         #         GIT_REF: HEAD | ||||||
|         restart: unless-stopped |         restart: unless-stopped | ||||||
|         volumes: |         volumes: | ||||||
|             - db:/srv/conduit/.local/share/conduit |             - db:/srv/conduit/.local/share/conduit | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue