From abe0dc3cb83358ba53ee4e94b07dd737704c8478 Mon Sep 17 00:00:00 2001 From: peterrus Date: Thu, 17 Mar 2022 15:17:02 +0100 Subject: [PATCH 1/2] Add healthchecks (#48) --- docker-compose.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 977f2aa..bbb5184 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,8 @@ services: image: postgres:12.1-alpine container_name: pleroma_db restart: always + healthcheck: + test: ["CMD", "pg_isready", "-U", "pleroma"] environment: POSTGRES_USER: pleroma POSTGRES_PASSWORD: ChangeMe! @@ -16,6 +18,12 @@ services: build: . image: pleroma container_name: pleroma_web + healthcheck: + test: + [ + "CMD-SHELL", + "wget -q --spider --proxy=off localhost:4000 || exit 1", + ] restart: always ports: - '4000:4000' @@ -32,4 +40,4 @@ services: DB_PASS: ChangeMe! DB_NAME: pleroma depends_on: - - db \ No newline at end of file + - db From 09fa1e81e3a13c919732b2779e19e5cc7cae3d59 Mon Sep 17 00:00:00 2001 From: peterrus Date: Thu, 17 Mar 2022 15:21:04 +0100 Subject: [PATCH 2/2] Fix and explain user buildargs (#49) * expose GID AND UID as optional build args * Give examples on how to use the build-time args in docker-compose * Prevent overwriting of build args * Warn about using regular docker run --- Dockerfile | 9 +++------ README.md | 13 +++++++++++-- docker-compose.yml | 9 ++++++++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index a4fe71e..ec22160 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,8 @@ FROM elixir:1.11.4-alpine -ENV UID=911 GID=911 \ - MIX_ENV=prod - ARG PLEROMA_VER=develop -ENV UID=911 GID=911 MIX_ENV=prod - +ARG UID=911 +ARG GID=911 ENV MIX_ENV=prod RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories \ @@ -40,4 +37,4 @@ COPY ./config.exs /etc/pleroma/config.exs EXPOSE 4000 -ENTRYPOINT ["/pleroma/docker-entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/pleroma/docker-entrypoint.sh"] diff --git a/README.md b/README.md index f7209f2..ba501eb 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,19 @@ services: - ./postgres:/var/lib/postgresql/data web: - build: . image: pleroma container_name: pleroma_web restart: always ports: - '4000:4000' + build: + context: . + # Feel free to remove or override this section + # See 'Build-time variables' in README.md + args: + - "UID=911" + - "GID=911" + - "PLEROMA_VER=develop" volumes: - ./uploads:/var/lib/pleroma/uploads - ./static:/var/lib/pleroma/static @@ -133,7 +140,7 @@ docker-compose build docker build -t pleroma . ``` -I prefer the latter because it's more verbose. +I prefer the latter because it's more verbose but this will ignore any build-time variables you have set in `docker-compose.yml`. Setup the database: @@ -200,6 +207,8 @@ docker build -t pleroma . --build-arg PLEROMA_VER=v2.0.7 # a version `a9203ab3` being the hash of the commit. (They're [here](https://git.pleroma.social/pleroma/pleroma/commits/develop)) +This value can also be set through `docker-compose.yml` as seen in the example file provided in this repository. + ## Other Docker images Here are other Pleroma Docker images that helped me build mine: diff --git a/docker-compose.yml b/docker-compose.yml index bbb5184..4315a83 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,6 @@ services: - ./postgres:/var/lib/postgresql/data web: - build: . image: pleroma container_name: pleroma_web healthcheck: @@ -27,6 +26,14 @@ services: restart: always ports: - '4000:4000' + build: + context: . + # Feel free to remove or override this section + # See 'Build-time variables' in README.md + args: + - "UID=1000" + - "GID=1000" + - "PLEROMA_VER=v2.4.2" volumes: - ./uploads:/var/lib/pleroma/uploads - ./static:/var/lib/pleroma/static