Add support for debian, implement Makefile
This commit is contained in:
parent
815d5644be
commit
6a2b257e38
4 changed files with 77 additions and 21 deletions
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# IntelliJ project files
|
||||
.idea
|
||||
*.iml
|
||||
out
|
||||
gen
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
|
|
@ -11,23 +11,9 @@ stages:
|
|||
before_script:
|
||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- docker build --pull --no-cache -t $HASH_TAG .
|
||||
- docker tag $HASH_TAG $BRANCH_TAG
|
||||
- docker push $HASH_TAG
|
||||
- docker push $BRANCH_TAG
|
||||
except:
|
||||
- master
|
||||
|
||||
build-master:
|
||||
stage: build
|
||||
script:
|
||||
- docker build --pull --no-cache -t $HASH_TAG .
|
||||
- docker tag $HASH_TAG $LATEST_TAG
|
||||
- docker push $HASH_TAG
|
||||
- docker push $LATEST_TAG
|
||||
- REGISTRY=$CI_REGISTRY_IMAGE VERSION=5.8 make push
|
||||
only:
|
||||
- master
|
||||
|
||||
|
|
|
|||
42
Dockerfile
42
Dockerfile
|
|
@ -1,13 +1,10 @@
|
|||
FROM composer:1.8 as composer
|
||||
|
||||
FROM php:7.3-fpm-alpine3.9
|
||||
|
||||
FROM php:7.3-fpm-alpine3.9 as alpine
|
||||
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache bash icu icu-dev libxml2-dev libzip-dev nodejs-current nodejs-npm
|
||||
|
||||
RUN apk add --no-cache --virtual .node-build-deps \
|
||||
g++ \
|
||||
make \
|
||||
|
|
@ -15,11 +12,42 @@ RUN apk add --no-cache --virtual .node-build-deps \
|
|||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-install -j$(nproc) intl opcache pdo_mysql zip \
|
||||
&& apk del .node-build-deps
|
||||
|
||||
RUN npm install -g yarn
|
||||
|
||||
ENV PATH="/app:/app/vendor/bin:${PATH}"
|
||||
|
||||
COPY conf.d/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
||||
# sane defaults for opcache
|
||||
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0"
|
||||
ENV PHP_OPCACHE_MAX_ACCELERATED_FILES="10000"
|
||||
ENV PHP_OPCACHE_MEMORY_CONSUMPTION="192"
|
||||
|
||||
|
||||
FROM php:7.3-fpm-stretch as stretch
|
||||
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
||||
WORKDIR /app
|
||||
RUN apt update \
|
||||
&& apt install --no-install-recommends -y \
|
||||
apt-transport-https \
|
||||
curl \
|
||||
gnupg \
|
||||
libzip-dev \
|
||||
software-properties-common \
|
||||
zlib1g-dev \
|
||||
&& echo 'deb https://deb.nodesource.com/node_10.x stretch main' > /etc/apt/sources.list.d/nodesource.list \
|
||||
&& echo 'deb-src https://deb.nodesource.com/node_10.x stretch main' >> /etc/apt/sources.list.d/nodesource.list \
|
||||
&& echo 'deb https://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list \
|
||||
&& curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
|
||||
&& curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
||||
&& apt update \
|
||||
&& apt install --no-install-recommends -y \
|
||||
libicu-dev \
|
||||
nodejs \
|
||||
npm \
|
||||
yarn \
|
||||
&& ln -s $(which nodejs) /usr/local/bin/node \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-install -j$(nproc) intl opcache pdo_mysql zip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
ENV PATH="/app:/app/node_modules/.bin:/app/vendor/bin:${PATH}"
|
||||
COPY conf.d/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
||||
# sane defaults for opcache
|
||||
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0"
|
||||
|
|
|
|||
28
Makefile
Normal file
28
Makefile
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
VERSION ?= test
|
||||
|
||||
.DEFAULT:
|
||||
@echo 'Invalid target.'
|
||||
@echo
|
||||
@echo ' alpine build alpine image'
|
||||
@echo ' stretch build debian stretch image'
|
||||
@echo ' all build all image variants'
|
||||
@echo
|
||||
@echo ' push build and push images to the registry'
|
||||
@echo
|
||||
|
||||
default: .DEFAULT
|
||||
|
||||
alpine:
|
||||
docker build --pull --target=alpine -t laravel-base:${VERSION}-alpine .
|
||||
|
||||
stretch:
|
||||
docker build --pull --target=stretch -t laravel-base:${VERSION}-stretch .
|
||||
|
||||
all: alpine stretch
|
||||
|
||||
push: all
|
||||
docker tag laravel-base:${VERSION}-alpine ${REGISTRY}:${VERSION}-alpine
|
||||
docker tag laravel-base:${VERSION}-stretch ${REGISTRY}:${VERSION}-stretch
|
||||
|
||||
docker push ${REGISTRY}:${VERSION}-alpine
|
||||
docker push ${REGISTRY}:${VERSION}-stretch
|
||||
Loading…
Add table
Add a link
Reference in a new issue