From 86e098cbdf75edb5a768394e369486eda553fb36 Mon Sep 17 00:00:00 2001 From: Mirio <1211529+Mirio@users.noreply.github.com> Date: Tue, 2 Apr 2024 22:59:31 +0200 Subject: [PATCH] chore: Update docker image + Adding init container --- Dockerfile | 5 +---- compose-demo.yaml | 13 +++++++++++-- compose.yaml | 12 ++++++++++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index ac40da4..ba24b93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,11 @@ FROM alpine:3.19 ARG USERNAME="app" -ARG GITCLIFF_VERSION="1.4.0" COPY nginx.conf /etc/nginx/nginx.conf RUN apk upgrade --no-cache && apk add --no-cache bash ffmpeg python3 py3-pip nginx sudo wget && adduser -D -s "/bin/bash" "${USERNAME}" \ && echo "app ALL = NOPASSWD: /bin/chown,/usr/sbin/nginx" > /etc/sudoers.d/app && chmod 400 /etc/sudoers.d/app \ - && chown -R app:app /var/lib/nginx && chown app:app /var/log/nginx && cd /tmp \ - && wget -q -O "gitcliff.tar.gz" "https://github.com/orhun/git-cliff/releases/download/v${GITCLIFF_VERSION}/git-cliff-${GITCLIFF_VERSION}-x86_64-unknown-linux-musl.tar.gz" \ - && tar xfz "gitcliff.tar.gz" && mv "git-cliff-${GITCLIFF_VERSION}/git-cliff" /usr/local/bin/ && rm -rf "git-cliff-${GITCLIFF_VERSION}" "gitcliff.tar.gz" + && chown -R app:app /var/lib/nginx && chown app:app /var/log/nginx USER "${USERNAME}" COPY . "/home/${USERNAME}" diff --git a/compose-demo.yaml b/compose-demo.yaml index 15d1225..18b58db 100644 --- a/compose-demo.yaml +++ b/compose-demo.yaml @@ -15,8 +15,15 @@ services: volumes: - ./example/psql:/var/lib/postgresql/data + init-container: + image: alpine:3.19 + command: chown -R 1000:1000 /persist /home/app/staticfiles + volumes: + - ./example/web:/persist + - ./example/web-static:/home/app/staticfiles + web: - image: ghcr.io/mirio/verbacap:v1.0.0 + image: ghcr.io/mirio/verbacap:v1.4.0 restart: always container_name: verbacap-web command: "run" @@ -25,6 +32,7 @@ services: depends_on: - redis - psql + - init-container environment: DATABASE_URL: "postgres://postgres:changeme@verbacap-psql:5432/postgres" DJANGO_SECRET_KEY: "Chang4M4" @@ -33,9 +41,10 @@ services: PERSIST_AUDIO_ROOTDIR: "/persist" volumes: - ./example/web:/persist + - ./example/web-static:/home/app/staticfiles celery: - image: ghcr.io/mirio/verbacap:v1.0.0 + image: ghcr.io/mirio/verbacap:v1.4.0 restart: always container_name: verbacap-celery command: "celery" diff --git a/compose.yaml b/compose.yaml index 802e753..e447221 100644 --- a/compose.yaml +++ b/compose.yaml @@ -6,8 +6,15 @@ services: restart: always container_name: verbacap-redis + init-container: + image: alpine:3.19 + command: chown -R 1000:1000 /persist /home/app/staticfiles + volumes: + - ./example/web:/persist + - ./example/web-static:/home/app/staticfiles + web: - image: ghcr.io/mirio/verbacap:v1.0.0 + image: ghcr.io/mirio/verbacap:v1.4.0 restart: always container_name: verbacap-web command: "run" @@ -15,6 +22,7 @@ services: - 8080:8080 depends_on: - redis + - init-container environment: DATABASE_URL: "postgres://POSTGRES_USERNAME:POSTGRES_PASSWORD@POSTGRES_HOSTNAME:5432/postgres" DJANGO_SECRET_KEY: "CHANGEME_SECRET" @@ -25,7 +33,7 @@ services: - CHANGEME_PERSIST_PATH:/persist celery: - image: ghcr.io/mirio/verbacap:v1.0.0 + image: ghcr.io/mirio/verbacap:v1.4.0 restart: always container_name: verbacap-celery command: "celery"