Skip to content
Snippets Groups Projects
Commit 948be891 authored by Edward Hicks's avatar Edward Hicks 🎱
Browse files

convert to multistage build

parent 57627110
No related merge requests found
Pipeline #208219 passed
......@@ -11,8 +11,6 @@ stages:
awsauth:
stage: awsauth
image: registry.containers.it.osu.edu/cache/gitlab-org/cloud-deploy/aws-base:latest
rules:
- !reference [.default_rules, rules]
script:
- if [ "${AWS_ACCESS_KEY_ID}" = "" ]; then echo "Missing AWS_ACCESS_KEY_ID"; exit 1; fi
- if [ "${AWS_SECRET_ACCESS_KEY}" = "" ]; then echo "Missing AWS_SECRET_ACCESS_KEY"; exit 1; fi
......@@ -35,8 +33,6 @@ build:
needs:
- job: awsauth
artifacts: true
rules:
- !reference [.default_rules, rules]
script:
- if [ $CI_COMMIT_REF_SLUG = "master" -o $CI_COMMIT_REF_SLUG = "main" ]; then TAG="latest"; fi
- if [ "$AWS_ECR_TOKEN" != "" ]; then ECRARG="--destination ${AWS_ECR_REGISTRY}/${CI_PROJECT_NAME}:${TAG}"; fi
......@@ -59,7 +55,7 @@ build:
" > /kaniko/.docker/config.json
- |
/kaniko/executor \
--single-snapshot \
--single-snapshot --target main \
--context "${CI_PROJECT_DIR}" \
--git "branch=${CI_COMMIT_REF_SLUG},depth=1,single-branch=true,recurse-submodules=true,shallow-submodules=true" \
--dockerfile "${CI_PROJECT_DIR}/Dockerfile" \
......@@ -71,21 +67,8 @@ build:
dotenv: build.env
container_scanning:
rules:
- !reference [.default_rules, rules]
dependencies:
- build
include:
- template: Security/Container-Scanning.gitlab-ci.yml
.default_rules:
rules:
# - changes:
# - "*.md"
# - ".*ignore"
# - Makefile
# - runlocal.sh
# - merge-from-base.sh
# when: never
- when: always
FROM docker.io/php:8.4-fpm
FROM docker.io/php:8.4-fpm AS main
LABEL maintainer="E. Stuart Hicks <hicks.367@osu.edu>"
# Preload users that we need consistent UIDs on
......@@ -114,3 +114,10 @@ RUN rm -rf /var/lib/apt/lists/* /tmp/* /usr/local/src/*
WORKDIR /var/www
ENTRYPOINT [ "/usr/local/bin/docker-php-entrypoint-custom" ]
CMD [ "/usr/local/sbin/php-fpm" ]
# Final squash & setup
FROM scratch
COPY --from=main / /
WORKDIR /var/www
ENTRYPOINT [ "/usr/local/bin/docker-php-entrypoint-custom" ]
CMD [ "/usr/local/sbin/php-fpm" ]
IMAGE = wheks-php84
build:
DOCKER_BUILDKIT=0 docker build --platform linux/amd64 --squash -t $(IMAGE) .
docker build --platform linux/amd64 -t $(IMAGE) .
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment