-
Notifications
You must be signed in to change notification settings - Fork 34
/
Dockerfile
81 lines (60 loc) · 2.61 KB
/
Dockerfile
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
FROM openjdk:8-jdk
RUN \
apt-get update && \
apt-get install -y unzip
ENV ADMIN_USER admin
ENV PAYARA_PATH /opt/payara5
RUN \
mkdir -p ${PAYARA_PATH}/deployments && \
useradd -b /opt -m -s /bin/bash -d ${PAYARA_PATH} payara && echo payara:payara | chpasswd
# specify Payara version to download
ENV PAYARA_PKG https://search.maven.org/remotecontent?filepath=fish/payara/distributions/payara/5.181/payara-5.181.zip
ENV PAYARA_VERSION 181
ENV PKG_FILE_NAME payara-full-${PAYARA_VERSION}.zip
# Download Payara Server, install, then remove downloaded file
RUN \
wget --quiet -O /opt/${PKG_FILE_NAME} ${PAYARA_PKG} && \
unzip -qq /opt/${PKG_FILE_NAME} -d /opt && \
chown -R payara:payara /opt && \
rm /opt/${PKG_FILE_NAME}
USER payara
WORKDIR ${PAYARA_PATH}
# set credentials to admin/admin
ENV ADMIN_PASSWORD admin
RUN echo 'AS_ADMIN_PASSWORD=\n\
AS_ADMIN_NEWPASSWORD='${ADMIN_PASSWORD}'\n\
EOF\n'\
>> /opt/tmpfile
RUN echo 'AS_ADMIN_PASSWORD='${ADMIN_PASSWORD}'\n\
EOF\n'\
>> /opt/pwdfile
# domain1
RUN ${PAYARA_PATH}/bin/asadmin --user ${ADMIN_USER} --passwordfile=/opt/tmpfile change-admin-password && \
${PAYARA_PATH}/bin/asadmin start-domain domain1 && \
${PAYARA_PATH}/bin/asadmin --user ${ADMIN_USER} --passwordfile=/opt/pwdfile enable-secure-admin && \
${PAYARA_PATH}/bin/asadmin stop-domain domain1 && \
rm -rf ${PAYARA_PATH}/glassfish/domains/domain1/osgi-cache
# production
RUN \
${PAYARA_PATH}/bin/asadmin --user ${ADMIN_USER} --passwordfile=/opt/tmpfile change-admin-password --domain_name=production && \
${PAYARA_PATH}/bin/asadmin start-domain production && \
${PAYARA_PATH}/bin/asadmin --user ${ADMIN_USER} --passwordfile=/opt/pwdfile enable-secure-admin && \
${PAYARA_PATH}/bin/asadmin stop-domain production && \
rm -rf ${PAYARA_PATH}/glassfish/domains/production/osgi-cache
# cleanup
RUN rm /opt/tmpfile
ENV PAYARA_DOMAIN domain1
ENV DEPLOY_DIR ${PAYARA_PATH}/deployments
ENV AUTODEPLOY_DIR ${PAYARA_PATH}/glassfish/domains/${PAYARA_DOMAIN}/autodeploy
# Default payara ports to expose
EXPOSE 4848 8009 8080 8181
ENV POSTBOOT_COMMANDS=${PAYARA_PATH}/post-boot-commands.asadmin
COPY generate_deploy_commands.sh ${PAYARA_PATH}/generate_deploy_commands.sh
COPY bin/startInForeground.sh ${PAYARA_PATH}/bin/startInForeground.sh
USER root
RUN \
chown -R payara:payara ${PAYARA_PATH}/generate_deploy_commands.sh && \
chmod a+x ${PAYARA_PATH}/generate_deploy_commands.sh && \
chmod a+x ${PAYARA_PATH}/bin/startInForeground.sh
USER payara
ENTRYPOINT ${PAYARA_PATH}/generate_deploy_commands.sh && ${PAYARA_PATH}/bin/startInForeground.sh --passwordfile=/opt/pwdfile --postbootcommandfile ${POSTBOOT_COMMANDS} ${PAYARA_DOMAIN}