Skip to content

Commit

Permalink
Use ENV vars for user and password file, which are recognized by asadmin
Browse files Browse the repository at this point in the history
Asadmin uses them automatically, no need to specify user and password file on command line.
Signed-off-by:Ondro Mihalyi <mihalyi@omnifish.ee>
  • Loading branch information
OndroMih committed Aug 17, 2023
1 parent e0cdd75 commit dba9666
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/main/resources/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ ARG AS_ADMIN_PASSWORD=admin \
PATH_GF_PASSWORD_FILE_FOR_CHANGE=/password-change.txt \
UID=1000 \
GID=1000
ENV PATH_GF_HOME=/opt/glassfish7
ENV AS_USER=admin \
AS_PASSWORD_FILE=/password.txt \
ENV PATH_GF_HOME=/opt/glassfish7 \
AS_ADMIN_USER=admin \
AS_ADMIN_PASSWORDFILE=/password.txt
ENV AS_USER=${AS_ADMIN_USER} \
AS_PASSWORD_FILE=${AS_ADMIN_PASSWORDFILE} \
AS_TRACE=false \
AS_TRACE_LOGGING=false \
AS_TRACE_BOOTSTRAP=false \
Expand Down Expand Up @@ -49,14 +51,14 @@ RUN true \
&& env | sort \
&& AS_START_TIMEOUT=120000 asadmin start-domain \
&& curl -o /dev/null http://localhost:4848 \
&& asadmin --user ${AS_USER} --passwordfile ${PATH_GF_PASSWORD_FILE_FOR_CHANGE} change-admin-password \
&& asadmin --passwordfile ${PATH_GF_PASSWORD_FILE_FOR_CHANGE} change-admin-password \
&& asadmin stop-domain --kill \
&& AS_START_TIMEOUT=120000 asadmin start-domain \
&& curl -o /dev/null http://localhost:4848 \
&& asadmin --user ${AS_USER} --passwordfile ${AS_PASSWORD_FILE} set-log-attributes org.glassfish.main.jul.handler.GlassFishLogHandler.enabled=false \
&& asadmin --user ${AS_USER} --passwordfile ${AS_PASSWORD_FILE} set-log-attributes org.glassfish.main.jul.handler.SimpleLogHandler.level=FINEST \
&& asadmin --user ${AS_USER} --passwordfile ${AS_PASSWORD_FILE} enable-secure-admin \
&& asadmin --user ${AS_USER} --passwordfile ${AS_PASSWORD_FILE} stop-domain --kill \
&& asadmin set-log-attributes org.glassfish.main.jul.handler.GlassFishLogHandler.enabled=false \
&& asadmin set-log-attributes org.glassfish.main.jul.handler.SimpleLogHandler.level=FINEST \
&& asadmin enable-secure-admin \
&& asadmin stop-domain --kill \
&& rm -f ${PATH_GF_SERVER_LOG} ${PATH_GF_PASSWORD_FILE_FOR_CHANGE} \
&& chown -R glassfish:glassfish "${PATH_GF_HOME}" \
&& chmod +x /usr/local/bin/docker-entrypoint.sh \
Expand Down

0 comments on commit dba9666

Please sign in to comment.