Added gitlab-ci to build docker image
This commit is contained in:
parent
55fcfa2e4a
commit
0b421c4d8e
13
.gitlab-ci.yml
Normal file
13
.gitlab-ci.yml
Normal file
@ -0,0 +1,13 @@
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
|
||||
# This folder is cached between builds
|
||||
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
|
||||
cache:
|
||||
key: ${CI_COMMIT_REF_SLUG}
|
||||
paths:
|
||||
- vendor/
|
||||
|
||||
include:
|
||||
- .gitlab-docker-x86_64.yml
|
32
.gitlab-docker-x86_64.yml
Normal file
32
.gitlab-docker-x86_64.yml
Normal file
@ -0,0 +1,32 @@
|
||||
docker:
|
||||
image: docker:latest
|
||||
|
||||
stage: build
|
||||
|
||||
services:
|
||||
- docker:dind
|
||||
|
||||
variables:
|
||||
VERSION: latest
|
||||
CACHETAG: build-${VERSION}
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
|
||||
tags:
|
||||
- docker
|
||||
- x86_64
|
||||
only:
|
||||
- master
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
- 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}
|
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM registry.leenooks.net/leenooks/php:8.0-fpm-mp
|
||||
|
||||
COPY . /var/www/html/
|
||||
|
||||
RUN mkdir /var/www/.composer \
|
||||
&& ([ -r auth.json ] && mv auth.json /var/www/.composer/) || true \
|
||||
&& touch .composer.refresh \
|
||||
&& mv .env.example .env \
|
||||
&& FORCE_PERMS=1 /sbin/init \
|
||||
&& rm -rf /var/www/.composer/*
|
Loading…
Reference in New Issue
Block a user