Skip to content

Commit

Permalink
Fixed #112 - Added new docker image: alpine 3.7 (tomcat-7)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzc34 committed Dec 10, 2017
1 parent b2da6c2 commit 1182927
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ none
none

### Improvement
none
- [#110 - Added new docker image: ubuntu 16.04 (tomcat-7)](https://github.com/Asqatasun/Contrast-Finder/issues/110)
- [#112 - Added new docker image: alpine 3.7 (tomcat-7)](https://github.com/Asqatasun/Contrast-Finder/issues/112)
- [#109 - Docker/pre-requisites/ - Added /etc/contrast-finder/softwares-version.txt](https://github.com/Asqatasun/Contrast-Finder/issues/109)

### Refactoring
none
Expand All @@ -30,9 +32,7 @@ none
none

### Task
- [#111 -.travis.yml - Add openjdk8 in addition to openjdk7](https://github.com/Asqatasun/Contrast-Finder/issues/111)
- [#110 - Added new docker image: ubuntu 16.04 (tomcat-7)](https://github.com/Asqatasun/Contrast-Finder/issues/110)
- [#109 - Docker/pre-requisites/ - Added /etc/contrast-finder/softwares-version.txt](https://github.com/Asqatasun/Contrast-Finder/issues/109)
- [#111 -.travis.yml - Added openjdk8 in addition to openjdk7](https://github.com/Asqatasun/Contrast-Finder/issues/111)
- [#106 - Added unit tests coverage report (cobertura-maven-plugin)](https://github.com/Asqatasun/Contrast-Finder/issues/106)


Expand Down
82 changes: 82 additions & 0 deletions docker/RELEASE/alpine-3.7_tomcat-7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
FROM asqatasun/contrast-finder:pre-requisites_alpine-3.7_tomcat-7
LABEL org.label-schema.schema-version = "1.0.0-rc.1" \
org.label-schema.name = "Contrast-Finder - WebApp (tomcat7 < jdk7 < alpine 3.7)" \
org.label-schema.version = "0.8.4-SNAPSHOT" \
org.label-schema.url = "https://contrast-finder.org" \
org.label-schema.vcs-url = "https://github.com/Asqatasun/Contrast-Finder" \
org.label-schema.docker.cmd = "docker run -p 8087:8080 -d asqatasun/contrast-finder:alpine" \
org.label-schema.usage = "https://github.com/Asqatasun/Contrast-Finder/tree/develop/documentation/" \
org.label-schema.description = "Contrast-Finder finds correct color contrasts for web accessibility."
# ----> documentation http://label-schema.org/

# #### usage ######################################################
#
# --- Building this docker image
# docker build -t asqatasun/contrast-finder .
# docker build -t asqatasun/contrast-finder --build-arg CONTRAST_FINDER_RELEASE=0.8.4-SNAPSHOT .
# docker build -t asqatasun/contrast-finder --build-arg SRC_URL_PREFIX=https://github.com/Asqatasun/Contrast-Finder/releases/download/v0.8.4-SNAPSHOT/ .
# docker build -t asqatasun/contrast-finder --build-arg SRC_URL=https://github.com/Asqatasun/Contrast-Finder/releases/download/v0.8.4-SNAPSHOT/contrast-finder_0.8.4-SNAPSHOT.i386.tar.gz .
#
# --- Launch a container
# docker run -p 127.0.0.1:8087:8080 --name contrast.finder -d asqatasun/contrast-finder
#
# --- Playing with this docker image
# docker exec -ti contrast.finder /bin/cat /softwares-version.txt
# docker exec -ti contrast.finder /bin/bash
# docker logs -f contrast.finder
#
# #### source code ###############################################
# https://github.com/Asqatasun/Contrast-Finder/releases/download/v${CONTRAST_FINDER_RELEASE}/contrast-finder_${CONTRAST_FINDER_RELEASE}.i386.tar.gz
# could be overridden with --build-arg CONTRAST_FINDER_RELEASE=<release>
# could be overridden with --build-arg SRC_URL_PREFIX=<url_prefix>
# could be overridden with --build-arg SRC_URL=<url>
#
# #### FROM ######################################################
# asqatasun/contrast-finder:pre-requisites_alpine-3.7_tomcat-7 https://github.com/Asqatasun/Contrast-Finder/blob/master/docker/pre-requisites/contrast-finder:pre-requisites_alpine-3.7_tomcat-7/Dockerfile
# |-- tomcat:7-jre7-alpine https://github.com/docker-library/tomcat/blob/master/7/jre7-alpine/Dockerfile
# |-- openjdk:7-jre-alpine https://github.com/docker-library/openjdk/blob/master/7-jre/alpine/Dockerfile
# |-- alpine:3.7 https://github.com/gliderlabs/docker-alpine/blob/master/versions/library-3.7/x86_64/Dockerfile
###################################################################

# build variables
ARG CONTRAST_FINDER_RELEASE="0.8.4-SNAPSHOT"
ARG SRC_URL_PREFIX="https://github.com/Asqatasun/Contrast-Finder/releases/download/v${CONTRAST_FINDER_RELEASE}"
ARG SRC_URL="${SRC_URL_PREFIX}/contrast-finder_${CONTRAST_FINDER_RELEASE}.i386.tar.gz"

# Install contrast-finder
RUN cd /root/ && \
wget ${SRC_URL} && \
tar -xzvf contrast-*.tar.gz && \
cd /root/contrast-*/install/ && \
mv -v contrast-*.war contrast-finder.war && \
mv -v contrast-*.war ${TOMCAT_DIR}webapps && \
rm -rf /root/contrast-* && \
echo ${CONTRAST_FINDER_RELEASE} >> ${INFO_FILE} && \
echo "" >> ${INFO_FILE} && \
echo "--- ${CONF_FILE} ---" >> ${INFO_FILE} && \
cat ${CONF_FILE} >> ${INFO_FILE} && \
echo "" >> ${INFO_FILE} && \
echo "--- Logs -----------" >> ${INFO_FILE} && \
echo "${TOMCAT_DIR}logs/catalina.*.log" >> ${INFO_FILE} && \
echo "${LOG_FILE}" >> ${INFO_FILE} && \
echo "--------------------" >> ${INFO_FILE} && \
cat ${INFO_FILE} > ${LOG_FILE} && echo "-- Install: Ok"

# environment variables
ENV CONTRAST_FINDER=${CONTRAST_FINDER_RELEASE}
ENV SRC=${SRC_URL}


# Health Check of the Docker Container
# ----> see asqatasun/contrast-finder:pre-requisites_(...)


###### don't work ############################
# CMD catalina.sh run ; \
# tail -f -n 200 ${TOMCAT_DIR}logs/catalina.*.log \
# ${LOG_FILE}
###################################################

# in "tomcat:7.0-jre7" DockerFile
# CMD ["catalina.sh", "run"]

1 change: 1 addition & 0 deletions docker/RELEASE/alpine-3.7_tomcat-7/README.md
57 changes: 57 additions & 0 deletions docker/SNAPSHOT-local/distrib/alpine-3.7_tomcat-7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM asqatasun/contrast-finder:pre-requisites_alpine-3.7_tomcat-7

# #### usage ######################################################
#
# --- Building this docker image
# docker build -t asqatasun/contrast-finder:SNAPSHOT_local .
#
# --- Launch a container
# docker run -p 127.0.0.1:8087:8080 --name contrast.finder -d asqatasun/contrast-finder:SNAPSHOT_local
#
# --- Playing with this docker image
# docker exec -ti contrast.finder /bin/cat /softwares-version.txt
# docker exec -ti contrast.finder /bin/bash
# docker logs -f contrast.finder
#
# #### FROM ######################################################
# asqatasun/contrast-finder:pre-requisites_alpine-3.7_tomcat-7 https://github.com/Asqatasun/Contrast-Finder/blob/master/docker/pre-requisites/contrast-finder:pre-requisites_alpine-3.7_tomcat-7/Dockerfile
# |-- tomcat:7-jre7-alpine https://github.com/docker-library/tomcat/blob/master/7/jre7-alpine/Dockerfile
# |-- openjdk:7-jre-alpine https://github.com/docker-library/openjdk/blob/master/7-jre/alpine/Dockerfile
# |-- alpine:3.7 https://github.com/gliderlabs/docker-alpine/blob/master/versions/library-3.7/x86_64/Dockerfile
###################################################################

# environment variables
ENV CONTRAST_FINDER_RELEASE="0.8.4-SNAPSHOT"

# Add contrast-finder .war
ADD contrast-finder_${CONTRAST_FINDER_RELEASE}.i386.tar.gz /root

# Install contrast-finder
RUN cd /root/contrast-*/install/ && \
mv -v contrast-*.war contrast-finder.war && \
mv -v contrast-*.war ${TOMCAT_DIR}webapps && \
rm -rf /root/contrast-* && \
echo ${CONTRAST_FINDER_RELEASE} >> ${INFO_FILE} && \
echo "" >> ${INFO_FILE} && \
echo "--- ${CONF_FILE} ---" >> ${INFO_FILE} && \
cat ${CONF_FILE} >> ${INFO_FILE} && \
echo "" >> ${INFO_FILE} && \
echo "--- Logs -----------" >> ${INFO_FILE} && \
echo "${TOMCAT_DIR}logs/catalina.*.log" >> ${INFO_FILE} && \
echo "${LOG_FILE}" >> ${INFO_FILE} && \
echo "--------------------" >> ${INFO_FILE} && \
cat ${INFO_FILE} > ${LOG_FILE} && echo "-- Install: Ok"


# Health Check of the Docker Container
# ----> see asqatasun/contrast-finder:pre-requisites_(...)


###### don't work ############################
# CMD catalina.sh run ; \
# tail -f -n 200 ${TOMCAT_DIR}logs/catalina.*.log \
# ${LOG_FILE}
###################################################

# in "tomcat:7.0-jre7" DockerFile
# CMD ["catalina.sh", "run"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
FROM tomcat:7-jre7-alpine
LABEL org.label-schema.schema-version = "1.0.0-rc.1" \
org.label-schema.name = "Contrast-Finder - WebApp pre-requisites (tomcat7 < jdk7 < alpine 3.7)" \
org.label-schema.url = "https://contrast-finder.org" \
org.label-schema.vcs-url = "https://github.com/Asqatasun/Contrast-Finder" \
org.label-schema.version = "0.8.4-SNAPSHOT"
# ----> documentation http://label-schema.org/

# #### usage ######################################################
#
# --- Building this docker image
# docker build -t contrast-finder:pre-requisites_Alpine-3.7_Tomcat-7 .
#
# #### FROM ######################################################
# tomcat:7-jre7-alpine https://github.com/docker-library/tomcat/blob/master/7/jre7-alpine/Dockerfile
# |-- openjdk:7-jre-alpine https://github.com/docker-library/openjdk/blob/master/7-jre/alpine/Dockerfile
# |-- alpine:3.7 https://github.com/gliderlabs/docker-alpine/blob/master/versions/library-3.7/x86_64/Dockerfile
###################################################################

###### PRE-REQUISITES ##########################################################

# build variables
ARG LOG_DIR="/var/log/contrast-finder/"
ARG CONF_DIR="/etc/contrast-finder/"
ARG URL_FOR_SPRING_INSTRUMENT_JAR="https://repo.spring.io/release/org/springframework/spring-instrument-tomcat/4.3.13.RELEASE/spring-instrument-tomcat-4.3.13.RELEASE.jar"

##################################################################################################
# https://repo.spring.io/release/org/springframework/spring-instrument-tomcat/
# LAST https://repo.spring.io/release/org/springframework/spring-instrument-tomcat/4.3.13.RELEASE/
# JAR spring-instrument-tomcat-4.3.13.RELEASE.jar
# SHA1 spring-instrument-tomcat-4.3.13.RELEASE.jar.sha1
##################################################################################################

# environment variables
ENV SPRING_INSTRUMENT_SRC="${URL_FOR_SPRING_INSTRUMENT_JAR}" \
TOMCAT_DIR="/usr/local/tomcat/" \
LOG_FILE="${LOG_DIR}contrast-finder.log" \
CONF_FILE="${CONF_DIR}contrast-finder.conf" \
INFO_FILE="/softwares-version.txt" \
WWWPORT="8080"
EXPOSE $WWWPORT

# build
RUN cd ${TOMCAT_DIR}lib/ && \
wget ${SPRING_INSTRUMENT_SRC} && \
apk add --no-cache curl && \
mkdir -p ${LOG_DIR} && \
mkdir -p ${CONF_DIR} && \
touch ${LOG_FILE} && \
touch ${CONF_FILE} && \
echo "--- OS -------------" >> ${INFO_FILE} && \
cat /etc/os-release >> ${INFO_FILE} && \
echo "" >> ${INFO_FILE} && \
echo "--- Java -----------" >> ${INFO_FILE} && \
echo ${JAVA_HOME} >> ${INFO_FILE} && \
java -version 2>> ${INFO_FILE} && \
echo "" >> ${INFO_FILE} && \
echo "--- Tomcat ---------" >> ${INFO_FILE} && \
${TOMCAT_DIR}bin/version.sh >> ${INFO_FILE} && \
echo "" >> ${INFO_FILE} && \
echo "--- Contrast-Finder ---" >> ${INFO_FILE}


#######################################################################################
# The command line "java -version" returns the output data
# at the STDERR stream (2 : error messages) rather than STDOUT (1).
# -----> java -version 2> tmp.txt
#
# https://stackoverflow.com/questions/21453774/redirect-java-version-to-file-or-variable
# https://stackoverflow.com/questions/39619087/how-to-write-output-of-java-version-to-a-text-file
#######################################################################################


# Health Check of the Docker Container
HEALTHCHECK --timeout=3s \
CMD curl --fail http://localhost:8080/contrast-finder/ || exit 1
######################################################################
# doc: https://docs.docker.com/engine/reference/builder/#healthcheck
# options: --interval=DURATION (default: 30s)
# --timeout=DURATION (default: 30s)
# --retries=N (default: 3)
# can be overridden at the command line 'docker run --health-cmd (...)'
######################################################################

# in "tomcat:7-jre7-alpine" DockerFile
# CMD ["catalina.sh", "run"]

0 comments on commit 1182927

Please sign in to comment.