From 450093db3cbdd6e2b97a5698f850a9caac2d388a Mon Sep 17 00:00:00 2001 From: Peter Giacomo Lombardo Date: Thu, 19 Dec 2024 10:51:20 +0100 Subject: [PATCH] Fix: Custom theme setup on container boot --- containers/docker/Dockerfile | 3 ++- .../docker/docker-compose-ephemeral.yml | 4 +--- containers/docker/docker-compose-mariadb.yml | 12 +++++----- containers/docker/docker-compose-mysql.yml | 12 +++++----- containers/docker/docker-compose-postgres.yml | 22 +++++++++---------- containers/docker/entrypoint.sh | 10 ++------- 6 files changed, 25 insertions(+), 38 deletions(-) diff --git a/containers/docker/Dockerfile b/containers/docker/Dockerfile index ec759f2b38ca..1d521fa465f5 100644 --- a/containers/docker/Dockerfile +++ b/containers/docker/Dockerfile @@ -81,7 +81,8 @@ RUN apk add --no-cache \ mariadb-connector-c \ nodejs \ sqlite-dev \ - tzdata + tzdata \ + yarn # Create a user and group to run the application ARG UID=1000 diff --git a/containers/docker/docker-compose-ephemeral.yml b/containers/docker/docker-compose-ephemeral.yml index 3eb0340a250d..1b6db3f34c48 100644 --- a/containers/docker/docker-compose-ephemeral.yml +++ b/containers/docker/docker-compose-ephemeral.yml @@ -1,7 +1,5 @@ -version: '2.1' services: - - passwordpusher: + pwpush: image: docker.io/pglombardo/pwpush:latest environment: DATABASE_URL: "sqlite3:db/db.sqlite3" diff --git a/containers/docker/docker-compose-mariadb.yml b/containers/docker/docker-compose-mariadb.yml index 988a45d9ed0b..9f7b5ccfbd21 100644 --- a/containers/docker/docker-compose-mariadb.yml +++ b/containers/docker/docker-compose-mariadb.yml @@ -1,22 +1,20 @@ -version: '2.1' - services: db: image: mariadb:11.4 ports: - "3306:3306" environment: - MARIADB_USER: 'passwordpusher_user' - MARIADB_PASSWORD: 'passwordpusher_passwd' - MARIADB_DATABASE: 'passwordpusher_db' + MARIADB_USER: 'pwpush_user' + MARIADB_PASSWORD: 'pwpush_passwd' + MARIADB_DATABASE: 'pwpush_db' MARIADB_RANDOM_ROOT_PASSWORD: 'yes' volumes: - - /var/lib/pwpush-mariadb/data:/var/lib/mysql + - ./mariadb-data:/var/lib/mysql pwpush: image: docker.io/pglombardo/pwpush:latest environment: - DATABASE_URL: 'mysql2://passwordpusher_user:passwordpusher_passwd@db:3306/passwordpusher_db' + DATABASE_URL: 'mysql2://pwpush_user:pwpush_passwd@db:3306/pwpush_db' ports: - "5100:5100" depends_on: diff --git a/containers/docker/docker-compose-mysql.yml b/containers/docker/docker-compose-mysql.yml index a4a1de74bc37..37784a583054 100644 --- a/containers/docker/docker-compose-mysql.yml +++ b/containers/docker/docker-compose-mysql.yml @@ -1,22 +1,20 @@ -version: '2.1' - services: db: image: mysql:8.0.32 ports: - "3306:3306" environment: - MYSQL_USER: 'passwordpusher_user' - MYSQL_PASSWORD: 'passwordpusher_passwd' - MYSQL_DATABASE: 'passwordpusher_db' + MYSQL_USER: 'pwpush_user' + MYSQL_PASSWORD: 'pwpush_passwd' + MYSQL_DATABASE: 'pwpush_db' MYSQL_RANDOM_ROOT_PASSWORD: 'yes' volumes: - - /var/lib/pwpush-mysql/data:/var/lib/mysql + - ./mysql-data:/var/lib/mysql pwpush: image: docker.io/pglombardo/pwpush:latest environment: - DATABASE_URL: 'mysql2://passwordpusher_user:passwordpusher_passwd@db:3306/passwordpusher_db' + DATABASE_URL: 'mysql2://pwpush_user:pwpush_passwd@db:3306/pwpush_db' ports: - "5100:5100" depends_on: diff --git a/containers/docker/docker-compose-postgres.yml b/containers/docker/docker-compose-postgres.yml index ff15dfcb18a4..f0d2a338f839 100644 --- a/containers/docker/docker-compose-postgres.yml +++ b/containers/docker/docker-compose-postgres.yml @@ -1,27 +1,25 @@ -version: '2.1' - services: - postgres: - image: docker.io/postgres:15 + db: + image: docker.io/postgres:16 volumes: - - /var/lib/postgresql/data:/var/lib/postgresql/data + - ./postgres-data:/var/lib/postgresql/data ports: - "5432:5432" environment: - POSTGRES_USER: passwordpusher_user - POSTGRES_PASSWORD: passwordpusher_passwd - POSTGRES_DB: passwordpusher_db + POSTGRES_USER: pwpush_user + POSTGRES_PASSWORD: pwpush_passwd + POSTGRES_DB: pwpush_db - passwordpusher: + pwpush: image: docker.io/pglombardo/pwpush:latest environment: - DATABASE_URL: 'postgres://passwordpusher_user:passwordpusher_passwd@postgres:5432/passwordpusher_db' + DATABASE_URL: 'postgres://pwpush_user:pwpush_passwd@db:5432/pwpush_db' ports: - "5100:5100" depends_on: - - postgres + - db links: - - postgres:postgres + - db:db # # You can set environment variables here, or in a .env file. See: # https://docs.docker.com/compose/environment-variables/ diff --git a/containers/docker/entrypoint.sh b/containers/docker/entrypoint.sh index cfd5b8395eec..419fbbefaaac 100755 --- a/containers/docker/entrypoint.sh +++ b/containers/docker/entrypoint.sh @@ -17,17 +17,11 @@ echo "" echo "Password Pusher: migrating database to latest..." bundle exec rake db:migrate -if [ "$PWP_PRECOMPILE" == "true" ] -then - echo "Password Pusher: precompiling assets for customisations..." +if [ -n "$PWP__THEME" ] || [ -n "$PWP_PRECOMPILE" ]; then + echo "Password Pusher: precompiling assets for customizations..." bundle exec rails assets:precompile fi -if [ -n "$PWP__THEME" ]; then - echo "Password Pusher: Rebuilding CSS for custom theme..." - yarn build:css -fi - echo "Password Pusher: starting puma webserver..." bundle exec puma -C config/puma.rb