From 17ed3736099d667a3a6f8bc4a02dfbfaee87f4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Melaine=20G=C3=A9rard?= Date: Fri, 10 Jan 2025 21:38:10 +0100 Subject: [PATCH] :sparkles: Ajout CI Docker --- .dockerignore | 7 ++++++ .gitea/workflows/build-docker.yml | 23 +++++++++++++++++ Dockerfile | 41 +++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitea/workflows/build-docker.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..57094a0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +var/ +vendor/ +.env.local +.env.*.local + +uploads/* +!uploads/.gitkeep \ No newline at end of file diff --git a/.gitea/workflows/build-docker.yml b/.gitea/workflows/build-docker.yml new file mode 100644 index 0000000..fb9cb77 --- /dev/null +++ b/.gitea/workflows/build-docker.yml @@ -0,0 +1,23 @@ +name: Build and Push Docker Image + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Build and Push with Kaniko + uses: aevea/action-kaniko@master + with: + image: camelia-studio/kumora + username: camelia + password: camelia + registry: ${{ secrets.REGISTRY_SERVER }} + tag: ${{ gitea.ref_name }} + tag_with_latest: true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..975c84b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +FROM dunglas/frankenphp + +ENV SERVER_NAME=":80" + +ARG APP_ENV=prod + +RUN apt-get update && apt-get install -y --no-install-recommends \ + acl \ + file \ + gettext \ + git \ + && rm -rf /var/lib/apt/lists/* + +RUN set -eux; \ + install-php-extensions \ + @composer \ + apcu \ + intl \ + opcache \ + zip \ + pdo_mysql \ + ; + +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" +ENV COMPOSER_ALLOW_SUPERUSER=1 + +COPY --link composer.* symfony.* ./ + +ENV APP_ENV=${APP_ENV} + + +# On ajoute un if pour installer les dépendances de dev si APP_ENV est égal à dev +RUN composer install --no-cache --prefer-dist --no-dev --optimize-autoloader --no-scripts --no-progress; + +COPY . . + +RUN rm -rf var/tailwind \ + && php bin/console importmap:install \ + && php bin/console tailwind:build \ + && php bin/console asset-map:compile \ + && php bin/console cache:clear