Skip to content

Commit

Permalink
chore: Update docker image + Adding init container
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirio committed Apr 2, 2024
1 parent ba0a1c5 commit 86e098c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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}"
Expand Down
13 changes: 11 additions & 2 deletions compose-demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
12 changes: 10 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@ 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"
ports:
- 8080:8080
depends_on:
- redis
- init-container
environment:
DATABASE_URL: "postgres://POSTGRES_USERNAME:POSTGRES_PASSWORD@POSTGRES_HOSTNAME:5432/postgres"
DJANGO_SECRET_KEY: "CHANGEME_SECRET"
Expand All @@ -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"
Expand Down

0 comments on commit 86e098c

Please sign in to comment.