refactor(web-app-shopware): make init script idempotent and handle admin via Ansible

- moved init.sh from template to files/ for direct copying and bind mounting
- removed hardcoded user creation from init process
- added database emptiness check before running system:install
- added new task 03_admin.yml to ensure admin user exists and update password/email via Ansible
- switched docker exec shell from bash to sh for Alpine compatibility
- updated Dockerfile and docker-compose.yml accordingly for mount-based init script
This commit is contained in:
2025-11-03 03:36:13 +01:00
parent 1cff5778d3
commit 48557b06e3
7 changed files with 109 additions and 62 deletions

View File

@@ -83,18 +83,9 @@ RUN set -eux; \
printf "framework:\n trusted_proxies: '%%env(TRUSTED_PROXIES)%%'\n" > /var/www/html/config/packages/framework.yaml; \
fi
# Copy the init script that your Compose mounts as volumes/init.sh in the build context
COPY --chown=www-data:www-data volumes/init.sh /usr/local/bin/init.sh
RUN chmod +x /usr/local/bin/init.sh
# Drop back to the app user
USER www-data
# Default envs (override via .env / compose env_file)
ENV APP_ENV=prod \
APP_URL=http://localhost:8000 \
TRUSTED_PROXIES=127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
# Expose internal port & add a lightweight healthcheck
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --retries=5 --start-period=20s \