Automation

This commit is contained in:
2022-09-25 16:09:04 +02:00
parent 7680378f28
commit 34fb57fa81
10 changed files with 114 additions and 12 deletions
+37
View File
@@ -0,0 +1,37 @@
# Use a PHP runtime as a parent image
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-§FRAMEWORK_TYPE§
# Set the working directory to /app
WORKDIR /§PROJECT_BUILDNAME§
# Install GD (required by mpdf)
RUN apt-get update && \
apt-get install -yq --no-install-recommends libpng-dev zlib1g-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install gd
# Install Memcached
RUN apt-get update && apt-get install -y libmemcached-dev \
&& pecl install memcached-3.1.5 \
&& docker-php-ext-enable memcached
# Copy the current directory contents into the container at /app
COPY ./app /§PROJECT_BUILDNAME§
COPY ./version /§PROJECT_BUILDNAME§
COPY ./config /§PROJECT_BUILDNAME§
COPY ./install /§PROJECT_BUILDNAME§
RUN chmod 744 /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install
ENTRYPOINT ["§PROJECT_BUILDNAME§-entrypoint"]
# Make port 80 available to the world outside this container
EXPOSE 80
+35
View File
@@ -0,0 +1,35 @@
# Use a PHP runtime as a parent image
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-§FRAMEWORK_TYPE§
# Set the working directory to /app
WORKDIR /§PROJECT_BUILDNAME§
# Install XDebug
RUN pecl install xdebug | tail -n 1 | awk -F"\"" '{print $2}' > /usr/local/etc/php/conf.d/xdebug.ini
RUN echo "\n\n[XDebug]\nxdebug.mode=debug\nxdebug.start_with_request=yes\nxdebug.client_host = §DEBUG_REMOTE_IP§\nxdebug.client_port = §DEBUG_REMOTE_PORT§\n" >> /usr/local/etc/php/conf.d/xdebug.ini
# Install Memcached
RUN apt-get update && apt-get install -y libmemcached-dev zlib1g-dev \
&& pecl install memcached-3.1.5 \
&& docker-php-ext-enable memcached
# Install SOAP
RUN docker-php-ext-install soap
# Copy the current directory contents into the container at /app
COPY ./app /§PROJECT_BUILDNAME§
COPY ./version /§PROJECT_BUILDNAME§
COPY ./config /§PROJECT_BUILDNAME§
COPY ./install /§PROJECT_BUILDNAME§
RUN chmod 744 /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install
ENTRYPOINT ["§PROJECT_BUILDNAME§-entrypoint"]
# Make port 80 available to the world outside this container
EXPOSE 80
+15
View File
@@ -0,0 +1,15 @@
FROM §FRAMEWORK_REPOSITORY§/§FRAMEWORK_IMAGE§:§FRAMEWORK_VERSION§-§FRAMEWORK_TYPE§-unit
WORKDIR /§PROJECT_BUILDNAME§
COPY ./app /§PROJECT_BUILDNAME§
COPY ./test /test§PROJECT_BUILDNAME§
COPY ./version /§PROJECT_BUILDNAME§
COPY ./config /§PROJECT_BUILDNAME§
COPY ./test/install /§PROJECT_BUILDNAME§
RUN chmod 744 /§PROJECT_BUILDNAME§/install
RUN /§PROJECT_BUILDNAME§/install
ENTRYPOINT ["/usr/local/bin/phpunit"]
CMD ["--help"]
+8 -4
View File
@@ -15,9 +15,10 @@ source "$DIR/../config"
source "$DIR/libs.sh"
usage() {
echo "Usage: $0 [-h] [-v] [-t: version] [image type, see below] " 1>&2;
echo "Usage: $0 [-h] [-v] [-t: version] -I <webserver|worker> [image type, see below] " 1>&2;
echo "This script builds framework docker images, the following options are available:" 1>&2;
echo " -h: This message" 1>&2;
echo " -I: Image (webserver or worker)" 1>&2;
echo " Image types (at least one, otherwise the script does nothing)" 1>&2;
echo " -a: All, same as ub" 1>&2;
echo " -u: Unit" 1>&2;
@@ -33,9 +34,13 @@ UNIT_MODE=0
DEBUG_MODE=0
TAG="local"
TYPE="webserver"
while getopts "t:hvaubd" o; do
while getopts "I:t:hvaubd" o; do
case "${o}" in
I)
TYPE="${OPTARG}"
;;
b)
BASE_MODE=1
;;
@@ -66,7 +71,6 @@ while getopts "t:hvaubd" o; do
done
cd ".."
# STANDARD MODE
@@ -78,7 +82,7 @@ if [[ $BASE_MODE -gt 0 ]]; then
OPTS+="v"
fi
$DIR/generateDockerfile.sh -$OPTS -o $DOCKERFILE
$DIR/generateDockerfile.sh -I "${TYPE}" -$OPTS -o $DOCKERFILE
msg "Building project image $TAG"
docker build -t $PROJECT_REPOSITORY/$PROJECT_GROUP/$PROJECT_BUILDNAME:$TAG -f $DOCKERFILE .
+8 -4
View File
@@ -142,12 +142,16 @@ if [[ $PUBLISH_MODE -eq 1 ]]; then
BUILDOPT+="v"
VERBOPT="-v"
fi
msg "running ./build.sh -$BUILDOPT -t $TAG"
./build.sh -$BUILDOPT -t $TAG
./run-unit.sh $VERBOPT -t $TAG
# WEBSERVER
msg "running ./build.sh -I webserver -$BUILDOPT -t $TAG-webserver"
./build.sh -I webserver -$BUILDOPT -t "$TAG-webserver"
./publish.sh $VERBOPT -t $TAG
./run-unit.sh $VERBOPT -t "$TAG-webserver"
./publish.sh $VERBOPT -t "$TAG-webserver"
if [[ $TAG_IMPLICIT -ne 1 ]]; then
git tag $TAG
+10 -4
View File
@@ -22,6 +22,7 @@ usage() {
echo " -d: Debug" 1>&2;
echo " -u: Unit" 1>&2;
echo " -b: Base" 1>&2;
echo " -I: Image (webserver or worker)" 1>&2;
echo " -i: Config Input File" 1>&2;
echo " -o: Output file" 1>&2;
echo " -v: Verbose" 1>&2;
@@ -36,8 +37,13 @@ DEBUG_MODE=0
UNIT_MODE=0
BASE_MODE=0
while getopts "i:o:hvdub" o; do
TYPE="webserver"
while getopts "i:o:I:hvdub" o; do
case "${o}" in
I)
TYPE="${OPTARG}"
;;
d)
DEBUG_MODE=1
SELECTED_MODES+=1
@@ -88,12 +94,12 @@ if [[ $OUTFILE == "" ]]; then
usage
fi
STARTING_FILE="../cicd/dockerfiles/build.dockerfile"
STARTING_FILE="../cicd/dockerfiles/${TYPE}/build.dockerfile"
if [[ $DEBUG_MODE -eq 1 ]]; then
STARTING_FILE="../cicd/dockerfiles/debug.dockerfile"
STARTING_FILE="../cicd/dockerfiles/${TYPE}/debug.dockerfile"
fi
if [[ $UNIT_MODE -eq 1 ]]; then
STARTING_FILE="../cicd/dockerfiles/test.dockerfile"
STARTING_FILE="../cicd/dockerfiles/${TYPE}/test.dockerfile"
fi
msg "Using source file $STARTING_FILE"
+1
View File
@@ -1,3 +1,4 @@
#!/bin/bash
git pull
git tag -l --sort=-version:refname | head -n 1