From 7be736340121e697314421a246fbf31b99ef1d42 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 5 Feb 2023 13:30:12 +1100 Subject: [PATCH] Update to alpine image --- .gitlab-ci.yml | 10 ++++++---- .gitlab-docker-x86_64.yml | 42 +++++++++++++++++---------------------- Dockerfile | 18 ++++++++--------- 3 files changed, 32 insertions(+), 38 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6b76ebb..7359d97 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,12 +1,14 @@ stages: - - build +# test +- build # This folder is cached between builds # http://docs.gitlab.com/ce/ci/yaml/README.html#cache cache: - key: ${CI_COMMIT_REF_SLUG} + key: ${CI_JOB_NAME_SLUG}-${CI_COMMIT_REF_SLUG} paths: - - vendor/ + - vendor/ include: - - .gitlab-docker-x86_64.yml +# .gitlab-test.yml +- .gitlab-docker-x86_64.yml diff --git a/.gitlab-docker-x86_64.yml b/.gitlab-docker-x86_64.yml index bc6634d..c33b8db 100644 --- a/.gitlab-docker-x86_64.yml +++ b/.gitlab-docker-x86_64.yml @@ -1,33 +1,27 @@ docker: - image: docker:latest + variables: + VERSION: latest + DOCKER_HOST: tcp://docker:2375 stage: build + image: docker:latest services: - - docker:dind - - variables: - VERSION: latest - CACHETAG: build-${VERSION} - DOCKER_HOST: tcp://docker:2375 - - tags: - - docker - - x86_64 - only: - - master + - docker:dind before_script: - - docker info - - docker version - - echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin - - if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > auth.json; fi + - docker info && docker version + - echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin + - if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > auth.json; fi script: - - if [ -f init ]; then chmod 500 init; fi - - ([ -z "$REFRESH" ] && docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG}) || echo "true" - - echo -n ${CI_COMMIT_SHORT_SHA} > VERSION - - rm -rf vendor/ database/schema database/seeders database/factories/* - - docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} . - - docker push ${CI_REGISTRY_IMAGE}:${VERSION} - - docker push ${CI_REGISTRY_IMAGE}:${CACHETAG} + - if [ -f init ]; then chmod 500 init; fi + - echo -n ${CI_COMMIT_SHORT_SHA} > VERSION + - rm -rf vendor/ database/schema database/seeders database/factories/* + - docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} . + - docker push ${CI_REGISTRY_IMAGE}:${VERSION} + tags: + - docker + - x86_64 + only: + - master diff --git a/Dockerfile b/Dockerfile index 07b0ad6..ec98ed3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,11 @@ -FROM registry.leenooks.net/leenooks/php:8.1-fpm-latest +FROM registry.dege.au/leenooks/php:8.1-fpm-alpine-pgsql COPY . /var/www/html/ -RUN export COMPOSER_HOME=/var/www/.composer \ - && mkdir -p /var/www/.composer \ - && ([ -r auth.json ] && mv auth.json /var/www/.composer/) || true \ - && touch .composer.refresh \ - && mv .env.example .env \ - && FORCE_PERMS=1 NGINX_START=FALSE /sbin/init \ - && chmod +x /var/www/html/artisan \ - && /var/www/html/artisan storage:link \ - && rm -rf /var/www/.composer +RUN mkdir -p ${COMPOSER_HOME} && \ + ([ -r auth.json ] && mv auth.json ${COMPOSER_HOME}) || true && \ + touch .composer.refresh && \ + mv .env.example .env && \ + FORCE_PERMS=1 NGINX_START=FALSE /sbin/init && \ + /var/www/html/artisan storage:link && \ + rm -rf ${COMPOSER_HOME}/*