-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.alpine-from-scratch
64 lines (63 loc) · 5.25 KB
/
Dockerfile.alpine-from-scratch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM openjdk:8u212-jdk-alpine3.9
LABEL MAINTAINER="Maksim Kostromin <daggerok@gmail.com>"
ENV PRODUCT="jboss-eap-7.3" \
JBOSS_USER="jboss"
ENV ADMIN_USER="admin" \
ADMIN_PASSWORD="Admin.123" \
JBOSS_USER_HOME="/home/${JBOSS_USER}" \
DOWNLOAD_BASE_URL="https://github.com/daggerok/${PRODUCT}/releases/download" \
JBOSS_EAP_PATCH="7.3.0"
ENV JBOSS_HOME="${JBOSS_USER_HOME}/${PRODUCT}" \
ARCHIVES_BASE_URL="${DOWNLOAD_BASE_URL}/archives" \
PATCHES_BASE_URL="${DOWNLOAD_BASE_URL}/${JBOSS_EAP_PATCH}"
ENV PATH="${JBOSS_HOME}/bin:/tmp:${PATH}" \
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0"
USER root
RUN ( apk fix --no-cache || echo "cannot fix." ) && \
( apk upgrade --no-cache || echo "cannot upgrade." ) && \
( apk cache -v clean || echo "cannot clean cache." ) && \
apk add --no-cache --update --upgrade \
busybox-suid bash wget ca-certificates unzip sudo openssh-client shadow curl && \
echo "${JBOSS_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
sed -i "s/.*requiretty$/Defaults !requiretty/" /etc/sudoers && \
addgroup --system -g 1001 -S ${JBOSS_USER} && \
adduser --system -h ${JBOSS_USER_HOME} -s /bin/ash -D -u 1001 ${JBOSS_USER} ${JBOSS_USER} && \
usermod -a -G ${JBOSS_USER} ${JBOSS_USER}
USER ${JBOSS_USER}
EXPOSE 8080 8443 9990
ENTRYPOINT ["/bin/ash", "-c"]
CMD ["${JBOSS_HOME}/bin/standalone.sh -b 0.0.0.0"]
WORKDIR /tmp
ADD --chown=jboss ./install.sh .
RUN wget ${ARCHIVES_BASE_URL}/jboss-eap-7.3.0.zip \
-q --no-cookies --no-check-certificate -O /tmp/jboss-eap-7.3.0.zip && \
unzip -q /tmp/jboss-eap-7.3.0.zip -d ${JBOSS_USER_HOME} && \
add-user.sh ${ADMIN_USER} ${ADMIN_PASSWORD} --silent && \
( standalone.sh --admin-only \
& ( sudo chmod +x /tmp/install.sh && \
install.sh && \
sudo apk del --no-cache --no-network --purge busybox-suid unzip openssh-client shadow && \
( sudo rm -rf /tmp/* /var/cache/apk /var/lib/apk /etc/apk/cache || echo "cleanup!" ) ) )
WORKDIR ${JBOSS_USER_HOME}
############################################ USAGE ##############################################
# #
# FROM daggerok/jboss-eap-7.3:7.3.0-alpine #
# #
# # debug: #
# ENV JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" #
# EXPOSE 5005 #
# #
# # health-check: #
# HEALTHCHECK --retries=33 \ #
# --timeout=1s \ #
# --interval=1s \ #
# --start-period=3s \ #
# CMD wget -q --spider http://127.0.0.1:8080/my-service/health || exit 1 #
# #CMD curl -f http://127.0.0.1:8080/my-servicehealth || exit 1 #
# #CMD test `netstat -ltnp | grep 9990 | wc -l` -ge 1 || exit 1 #
# COPY --chown=jboss ./target/*.war ${JBOSS_HOME}/standalone/deployments/my-service.war #
# #
# # or multi-deployment: #
# COPY --chown=jboss ./target/*.war ./build/libs/*.war ${JBOSS_HOME}/standalone/deployments/ #
# #
#################################################################################################