Import build configuration

This commit is contained in:
Deon George 2016-08-11 11:22:20 +10:00
parent 98b9802e4f
commit 9470ad44bd
6 changed files with 125 additions and 10 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
image*bz2

View File

@ -1,12 +1,40 @@
image: docker:latest image: docker:latest
stages:
- test
- build
variables:
VERSION: php53
DOCKER_IMAGE: leenooks/lamps
DOCKER_REGISTRY: registry.leenooks.net
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
services: services:
- docker:dind - ${DOCKER_REGISTRY}/leenooks/ci-docker:dind
before_script: before_script:
- docker info - docker info
- docker version
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY}
test:
stage: test
script:
- cat /etc/hosts
- env|sort
- docker build -t ${DOCKER_IMAGE}:${VERSION} .
- docker images
only:
- debug
build: build:
stage: build stage: build
script: script:
- docker build -t leenooks/lamps . - docker build -t ${DOCKER_IMAGE}:${VERSION} .
- docker tag ${DOCKER_IMAGE}:${VERSION} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION}
- docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION}
tags:
- docker
only:
- master

6
.my.cnf Normal file
View File

@ -0,0 +1,6 @@
[mysql]
user=root
password=ln3550ms
[mysqldump]
user=root
password=ln3550ms

5
10-default.conf Normal file
View File

@ -0,0 +1,5 @@
<Directory /var/www/sites>
AllowOverride AuthConfig FileInfo Indexes Limit Options
Options FollowSymLinks
Require all denied
</Directory>

View File

@ -1,5 +1,5 @@
# NAME leenooks/lamps # NAME leenooks/lamps
# VERSION latest # VERSION php53
# BUILD docker build -t="leenooks/lamps" . # BUILD docker build -t="leenooks/lamps" .
# START docker run -dp 80:80 [-p 443:443 ] -p 2022:22 \ # START docker run -dp 80:80 [-p 443:443 ] -p 2022:22 \
# -e NO_MAIL=TRUE \ # -e NO_MAIL=TRUE \
@ -20,14 +20,11 @@
# --restart=always --name=lamp leenooks/hosting $@ # --restart=always --name=lamp leenooks/hosting $@
# CRON: docker exec -it lamp /usr/sbin/awstats.sh # CRON: docker exec -it lamp /usr/sbin/awstats.sh
FROM leenooks/base:latest FROM registry.leenooks.net/leenooks/base:7
RUN yum -y install epel-release && yum clean all RUN yum -y install epel-release && yum clean all
# RUN yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm && yum clean all && rm -rf /var/tmp/*
# EPEL & Leenooks packages # EPEL & Leenooks packages
#RUN yum -y install --enabler remi-php54 \
RUN yum -y install \ RUN yum -y install \
httpd \ httpd \
mariadb-server \ mariadb-server \
@ -38,6 +35,7 @@ RUN yum -y install \
php-mysql \ php-mysql \
php-pdo \ php-pdo \
php-xml \ php-xml \
php-composer-installers.noarch \
m4 \ m4 \
opendkim \ opendkim \
sendmail \ sendmail \
@ -46,7 +44,8 @@ RUN yum -y install \
ln-http \ ln-http \
ln-awstats \ ln-awstats \
ln-mail-server \ ln-mail-server \
openssh-server \ openssh-server \
git \
&& yum clean all && yum clean all
COPY .my.cnf /root/ COPY .my.cnf /root/
@ -55,10 +54,16 @@ RUN ln -f /etc/.ln/httpd/conf.d/awstats.conf /etc/httpd/conf.d/awstats.conf && l
EXPOSE 80 443 EXPOSE 80 443
COPY init /sbin/
# Starting # Starting
COPY init /sbin/
ENTRYPOINT [ "/sbin/init" ] ENTRYPOINT [ "/sbin/init" ]
CMD [ "start" ] CMD [ "start" ]
RUN composer global require "laravel/installer"
RUN composer require --dev --no-update "xethron/migrations-generator:dev-l5" && \
composer require --dev --no-update "way/generators:dev-feature/laravel-five-stable" && \
composer config repositories.repo-name git "git@github.com:jamisonvalenta/Laravel-4-Generators.git"
RUN useradd -c "Hosting Admin User" -m lamp && su lamp -lc "composer global require laravel/installer"
RUN yum -y install tsmpipe && yum clean all RUN yum -y install tsmpipe && yum clean all

70
init Executable file
View File

@ -0,0 +1,70 @@
#!/bin/bash
set -e
NO_DB=${NO_DB:-FALSE}
NO_SSH=${NO_SSH:-TRUE}
NO_MAIL=${NO_MAIL:-FALSE}
NO_HTTP=${NO_HTTP:-FALSE}
NAME="LAMPS"
function stop {
echo "Stopping ${NAME}"
[ "$NO_MAIL" != "TRUE" ] && kill $(cat /var/run/opendkim.pid) && kill $(cat /var/run/sendmail.pid|head -1)
[ "$NO_SSH" != "TRUE" ] && kill $(cat /var/run/sshd.pid)
[ "$NO_DB" != "TRUE" ] && kill $(cat /var/run/mariadb/mariadb.pid)
[ "$NO_HTTP" != "TRUE" ] && rm -f /var/run/httpd/authdigest_shm.$(cat /var/run/httpd/httpd.pid) && kill $(cat /var/run/httpd/httpd.pid)
}
trap 'stop' SIGTERM
if [ "$1" == "start" ]; then
if [ "$NO_MAIL" != "TRUE" ]; then
if [ -z `hostname --domain` ]; then
echo "You must start this container with --hostname= specifying a domain name"
exit 1
fi
echo "Starting OpenDKIM..."
[ ! -f /etc/opendkim/keys/default.private ] && /usr/sbin/opendkim-default-keygen
[ -x /usr/sbin/opendkim ] && /usr/sbin/opendkim -x /etc/opendkim.conf -P /var/run/opendkim.pid -f &
echo "Starting Sendmail..."
cd /etc/mail && make && m4 sendmail.mc > sendmail.cf && /usr/sbin/sendmail -q1h -bD &
else
echo "! NOT starting MAIL"
fi
if [ "$NO_SSH" != "TRUE" ]; then
echo "Starting SSHD..."
getent passwd lamp || useradd -c "Hosting Admin User" -m lamp
[ -x /usr/sbin/sshd-keygen ] && /usr/sbin/sshd-keygen
[ -x /usr/sbin/sshd ] && /usr/sbin/sshd
else
echo "! NOT starting SSH"
fi
if [ "$NO_DB" != "TRUE" ]; then
echo "Starting Maria DB..."
[ -x /usr/libexec/mariadb-prepare-db-dir ] && /usr/libexec/mariadb-prepare-db-dir
[ -x /usr/bin/mysqld_safe ] && /usr/bin/mysqld_safe --basedir=/usr &
else
echo "! NOT starting DB"
fi
if [ "$NO_HTTP" != "TRUE" ]; then
if [ -d /etc/awstats ]; then
find /etc/awstats/ -type l | xargs -n 5 rm -f
[ -e /var/www/sites/*/awstats/awstats*conf ] && find /var/www/sites/*/awstats/awstats*conf -type f -exec ln -sf {} /etc/awstats/ \;
fi
echo "Starting HTTP..."
find /etc/httpd/conf.d/ -type l | xargs -n 5 rm -f
find /etc/httpd/sites.d -type f -exec ln -sf {} /etc/httpd/conf.d/ \;
[ -x /usr/sbin/httpd ] && /usr/sbin/httpd -DFOREGROUND &
else
echo "! NOT starting HTTP"
fi
wait
else
exec $@
fi