WIP: Untested, solo caricati file di test
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# Use a PHP runtime as a parent image
|
||||
FROM 662348923997.dkr.ecr.eu-west-1.amazonaws.com/asdynamics/asdphp-kube:§ASDPHP_VERSION§
|
||||
|
||||
# Set the working directory to /app
|
||||
WORKDIR /§PROJECT_BUILDNAME§
|
||||
|
||||
# Install some useful packages
|
||||
ENV PACKAGES="dnsutils nano"
|
||||
RUN apt-get update && \
|
||||
apt-get install -yq --no-install-recommends $PACKAGES && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 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
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# Use a PHP runtime as a parent image
|
||||
FROM 662348923997.dkr.ecr.eu-west-1.amazonaws.com/asdynamics/asdphp-kube:§ASDPHP_VERSION§
|
||||
|
||||
# Set the working directory to /app
|
||||
WORKDIR /§PROJECT_BUILDNAME§
|
||||
|
||||
# Install some useful packages
|
||||
ENV PACKAGES="dnsutils nano"
|
||||
RUN apt-get update && \
|
||||
apt-get install -yq --no-install-recommends $PACKAGES && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 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.remote_enable = 1\nxdebug.remote_autostart = 1\nxdebug.remote_host = §DEBUG_REMOTE_IP§\nxdebug.remote_port = §DEBUG_REMOTE_PORT§\n" >> /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
# 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
|
||||
@@ -0,0 +1,15 @@
|
||||
FROM 662348923997.dkr.ecr.eu-west-1.amazonaws.com/asdynamics/unittest/asdphp-kube:§ASDPHP_VERSION§
|
||||
|
||||
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"]
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
|
||||
function help() {
|
||||
printf "\n"
|
||||
printf "generateDockerfile [-h] [-t|b|d]\n"
|
||||
printf "\n"
|
||||
printf "Version name is mandatory.\n"
|
||||
printf "Available options:\n"
|
||||
printf "\t -h this message\n"
|
||||
printf "\t -t Test dockerfile\n"
|
||||
printf "\t -b Build dockerfile\n"
|
||||
printf "\t -d Debug dockerfile\n"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
BUILD_VERSION=false
|
||||
TEST_VERSION=false
|
||||
DEBUG_VERSION=false
|
||||
|
||||
VERSION_ACTIVE=0
|
||||
|
||||
while getopts ":hbtd" optname
|
||||
do
|
||||
case "$optname" in
|
||||
"h")
|
||||
OPTION_HELP=true
|
||||
;;
|
||||
"b")
|
||||
# This version is the running environment
|
||||
STARTING_FILE="dockerfiles/build.dockerfile"
|
||||
VERSION_ACTIVE=$VERSION_ACTIVE+1
|
||||
;;
|
||||
"t")
|
||||
# This version is the unit-test only environment
|
||||
STARTING_FILE="dockerfiles/test.dockerfile"
|
||||
VERSION_ACTIVE=$VERSION_ACTIVE+1
|
||||
;;
|
||||
"d")
|
||||
# This version is a running environment with x-debugger included
|
||||
STARTING_FILE="dockerfiles/debug.dockerfile"
|
||||
VERSION_ACTIVE=$VERSION_ACTIVE+1
|
||||
;;
|
||||
":")
|
||||
echo "No argument value for option $OPTARG"
|
||||
exit 1;
|
||||
;;
|
||||
*)
|
||||
# Should not occur
|
||||
echo "Unknown error while processing options"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
if [[ $VERSION_ACTIVE -eq 0 ]]; then
|
||||
echo "Impossible to run script without chosing a version between debug, test and build";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [[ $VERSION_ACTIVE -gt 1 ]]; then
|
||||
echo "Invalid version requested, only one between -t -d and -b can be used, $VERSION_ACTIVE passed";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
my_dir="$(dirname "$0")"
|
||||
DIR_RETURN=`pwd`
|
||||
|
||||
cd "$my_dir"
|
||||
|
||||
source ../config
|
||||
|
||||
# echo "sed -e 's/§ASDPHP_VERSION§/${ASDPHP_VERSION}/g'";
|
||||
# echo "sed -e 's/§DEBUG_REMOTE_IP§/${DEBUG_REMOTE_IP}/g'";
|
||||
# echo "sed -e 's/§PROJECT_BUILDNAME§/${PROJECT_BUILDNAME}/g'";
|
||||
# echo "sed -e 's~§PROJECT_GROUP§~${PROJECT_GROUP}~g'";
|
||||
# echo "sed -e 's/§DEBUG_REMOTE_PORT§/${DEBUG_REMOTE_PORT}/g'";
|
||||
|
||||
cat "$STARTING_FILE" |
|
||||
sed -e "s/§ASDPHP_VERSION§/${ASDPHP_VERSION}/g" |
|
||||
sed -e "s/§DEBUG_REMOTE_IP§/${DEBUG_REMOTE_IP}/g" |
|
||||
sed -e "s/§PROJECT_BUILDNAME§/${PROJECT_BUILDNAME}/g" |
|
||||
sed -e "s~§PROJECT_GROUP§~${PROJECT_GROUP}~g" |
|
||||
sed -e "s/§DEBUG_REMOTE_PORT§/${DEBUG_REMOTE_PORT}/g" \
|
||||
> "$DIR_RETURN/Dockerfile"
|
||||
|
||||
|
||||
cd "$DIR_RETURN"
|
||||
Reference in New Issue
Block a user