Skip to content

Commit

Permalink
Fix automated build
Browse files Browse the repository at this point in the history
  • Loading branch information
jdel committed Jan 13, 2017
1 parent 59eced4 commit e630133
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
FROM alpine:3.5
MAINTAINER Julien Del-Piccolo <julien@del-piccolo.com>
ARG BRANCH="master"
ARG COMMIT=""
LABEL branch=${BRANCH}
LABEL commit=${COMMIT}

RUN apk update && apk add --no-cache supervisor apache2 php5-apache2 php5-ctype \
&& apk add --virtual=.build-dependencies php5 php5-phar php5-json php5-openssl git \
&& rm -rf /var/www/localhost/htdocs \
&& git clone -b ${BRANCH} https://github.com/jdel/sspks.git /var/www/localhost/htdocs \
&& rm -rf /var/www/localhost/htdocs/* \
&& cd /var/www/localhost/htdocs/ \
&& git init && git remote add origin https://github.com/jdel/sspks.git \
&& git fetch origin ${COMMIT} \
&& wget -q -O /usr/local/bin/composer http://getcomposer.org/download/1.3.1/composer.phar \
&& chmod +x /usr/local/bin/composer \
&& cd /var/www/localhost/htdocs \
&& if [ -f composer.json ]; then composer install --no-dev; fi \
&& rm -f /usr/local/bin/composer \
&& composer install --no-dev \
; rm -f /usr/local/bin/composer \
&& apk del .build-dependencies \
&& rm -rf /var/cache/apk/* \
&& mkdir /run/apache2 \
Expand Down
6 changes: 5 additions & 1 deletion hooks/build
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env sh

docker build --build-arg=BRANCH=$(git rev-parse --abbrev-ref HEAD) -t $IMAGE_NAME .
if [ -z "${DOCKER_TAG}" ]; then
docker build --build-arg=COMMIT=$(git rev-parse HEAD) --build-arg=BRANCH=$(git rev-parse --abbrev-ref HEAD) -t $IMAGE_NAME .
else
docker build --build-arg=COMMIT=$(git rev-parse HEAD) --build-arg=BRANCH=${DOCKER_TAG} -t $IMAGE_NAME .
fi

0 comments on commit e630133

Please sign in to comment.