Skip to content

Commit

Permalink
chore: Cleanup gitlab-ci and multistaged Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Nov 15, 2024
1 parent ba8ef7c commit 4085408
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 30 deletions.
11 changes: 2 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ roadiz_skeleton_test:
roadiz_skeleton_build_develop:
stage: build
image: docker:git
# Create a docker image only when a new tag is pushed
only:
- develop
services:
Expand All @@ -67,18 +66,12 @@ roadiz_skeleton_build_develop:
# Connect to your Gitlab Registry
- "echo \"Registry image: ${CI_REGISTRY_IMAGE} for develop\""
- "docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}"
#- "docker buildx bake --set=api-php.args.COMPOSER_DEPLOY_TOKEN=${COMPOSER_DEPLOY_TOKEN} --push"
#- "docker buildx bake --set *.args.COMPOSER_DEPLOY_TOKEN=${COMPOSER_DEPLOY_TOKEN} --push"
- "docker buildx bake --push"

#
# Build App docker image with vendor and built assets
# included. You must configure your Gitlab Runner to
# support Docker-in-docker commands.
#
roadiz_skeleton_build_tag:
stage: build
image: docker:git
# Create a docker image only when a new tag is pushed
only:
- tags
services:
Expand All @@ -94,7 +87,7 @@ roadiz_skeleton_build_tag:
# Connect to your Gitlab Registry
- "echo \"Registry image: ${CI_REGISTRY_IMAGE} for tag ${CI_COMMIT_TAG}\""
- "docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}"
#- "docker buildx bake --set=api-php.args.COMPOSER_DEPLOY_TOKEN=${COMPOSER_DEPLOY_TOKEN} --push"
#- "docker buildx bake --set *.args.COMPOSER_DEPLOY_TOKEN=${COMPOSER_DEPLOY_TOKEN} --push"
- "docker buildx bake --push"

create_gitlab_release:
Expand Down
28 changes: 7 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ apt-get --quiet --yes --purge --autoremove upgrade
apt-get --quiet --yes --no-install-recommends --verbose-versions install \
less \
sudo \
git \
cron \
ffmpeg
rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -98,9 +99,7 @@ RUN <<EOF
apt-get --quiet update
apt-get --quiet --yes --purge --autoremove upgrade
# Packages - System
apt-get --quiet --yes --no-install-recommends --verbose-versions install \
make \
git
apt-get --quiet --yes --no-install-recommends --verbose-versions install make
rm -rf /var/lib/apt/lists/*
EOF

Expand All @@ -115,8 +114,9 @@ USER www-data

FROM php AS php-prod

# If you want to use a private repository, you can use a deploy token
# If you depend on private Gitlab repositories, you must use a deploy token and username
#ARG COMPOSER_DEPLOY_TOKEN
#ARG COMPOSER_DEPLOY_TOKEN_USER="gitlab+deploy-token-1"

ENV APP_ENV=prod
ENV APP_RUNTIME_ENV=prod
Expand All @@ -133,10 +133,10 @@ COPY --link --chmod=755 docker/php/docker-cron-entrypoint /usr/local/bin/docker-
USER www-data

# Composer
COPY --link --chown=www-data:www-data composer.* symfony.* .
COPY --link --chown=www-data:www-data composer.* symfony.* ./
RUN <<EOF
# If you want to use a private repository, you can use a deploy token
#composer config gitlab-token.gitlab.com ${COMPOSER_DEPLOY_TOKEN}
# If you depend on private Gitlab repositories, you must use a deploy token and username
#composer config gitlab-token.gitlab.rezo-zero.com ${COMPOSER_DEPLOY_TOKEN_USER} ${COMPOSER_DEPLOY_TOKEN}
composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress
EOF

Expand All @@ -147,20 +147,6 @@ composer dump-autoload --classmap-authoritative --no-dev
bin/console cache:warmup --no-optional-warmers
bin/console assets:install
bin/console themes:assets:install Rozier
chmod 0755 /var/www/html/bin/console
chmod 0750 /var/www/html
chmod 0750 \
/var/www/html/bin \
/var/www/html/config \
/var/www/html/docker \
/var/www/html/migrations \
/var/www/html/public \
/var/www/html/src \
/var/www/html/templates \
/var/www/html/translations \
/var/www/html/var \
/var/www/html/vendor
chown www-data:www-data /var/www/html
EOF

VOLUME /var/www/html/config/jwt \
Expand Down

0 comments on commit 4085408

Please sign in to comment.