Updated docker image build so that it sets shlink's version

This commit is contained in:
Alejandro Celaya 2019-08-16 19:42:39 +02:00
parent 65d1301195
commit 924383ccc8
4 changed files with 15 additions and 0 deletions

View File

@ -21,3 +21,4 @@ phpstan.neon
**/test*
build*
.github
hooks

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
.idea
build
!hooks/build
composer.lock
composer.phar
vendor/

View File

@ -1,6 +1,8 @@
FROM php:7.3.8-cli-alpine3.10
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"
ARG SHLINK_VERSION=1.18.1
ENV SHLINK_VERSION ${SHLINK_VERSION}
ENV SWOOLE_VERSION 4.3.3
ENV COMPOSER_VERSION 1.9.0
@ -39,6 +41,7 @@ RUN rm -rf ./docker && \
# Add shlink to the path to ease running it after container is created
RUN ln -s /etc/shlink/bin/cli /usr/local/bin/shlink
RUN sed -i "s/%SHLINK_VERSION%/${SHLINK_VERSION}/g" config/autoload/app_options.global.php
# Expose swoole port
EXPOSE 8080

10
hooks/build Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -ex
if [[ ${SOURCE_BRANCH} == 'master' ]]; then
SHLINK_RELEASE='latest'
else
SHLINK_RELEASE=${SOURCE_BRANCH}
fi
docker build --build-arg SHLINK_VERSION=${SHLINK_RELEASE#?} -t ${IMAGE_NAME} .