Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/docker-embedded-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish Embedded GlassFish Docker Image to GitHub

on:
workflow_dispatch:

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_ID: "ghcr.io/${{ github.repository_owner }}/embedded-glassfish"
IMAGE_VERSION: 7.1.0

jobs:
build:

runs-on: ubuntu-latest

permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Maven Configure
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
platforms: linux/amd64,linux/arm64

- name: Build
run: mvn clean prepare-package -Dglassfish.version=$IMAGE_VERSION

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Additional Info
run: |
mvn -v
uname -a
docker buildx ls
docker buildx imagetools inspect ${{ env.IMAGE_ID }}:latest || echo "No image ${{ env.IMAGE_ID }}:latest exists"

- name: Build and Deploy
uses: docker/build-push-action@v6
with:
context: images/embedded/${{ env.IMAGE_VERSION }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.IMAGE_VERSION }},${{ env.IMAGE_ID }}:latest

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Publish to GitHub
name: Publish GlassFish Server Docker Image to GitHub

on:
workflow_dispatch:
Expand All @@ -8,7 +8,7 @@ env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_ID: "ghcr.io/${{ github.repository_owner }}/glassfish"
IMAGE_VERSION: 7.0.25
IMAGE_VERSION: 7.1.0

jobs:
build:
Expand Down Expand Up @@ -49,12 +49,12 @@ jobs:
mvn -v
uname -a
docker buildx ls
docker buildx imagetools inspect ${{ env.IMAGE_ID }}:latest
docker buildx imagetools inspect ${{ env.IMAGE_ID }}:latest || echo "No image ${{ env.IMAGE_ID }}:latest exists"

- name: Build and Deploy
uses: docker/build-push-action@v6
with:
context: ${{ env.IMAGE_VERSION }}
context: images/server/${{ env.IMAGE_VERSION }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.IMAGE_VERSION }},${{ env.IMAGE_ID }}:latest
Expand Down
49 changes: 49 additions & 0 deletions images/embedded/7.1.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM eclipse-temurin:21-jdk

LABEL org.opencontainers.image.base.name="eclipse-temurin:21-jdk"
LABEL org.opencontainers.image.source="https://github.com/eclipse-ee4j/glassfish.docker"
LABEL org.opencontainers.image.url="https://github.com/eclipse-ee4j/glassfish.docker/wiki"

LABEL org.opencontainers.image.title="Embedded Eclipse GlassFish"
LABEL org.opencontainers.image.description="The Official Eclipse Docker Image for Embedded GlassFish"
LABEL org.opencontainers.image.version="7.1.0"

LABEL org.opencontainers.image.authors="glassfish-dev@eclipse.org"
LABEL org.opencontainers.image.vendor="Eclipse Foundation"
LABEL org.opencontainers.image.licenses="EPL-2.0"

EXPOSE 8080 8181

# You should use own credentials and own files! These are just defaults.
ARG UID=1000 \
GID=1000
ENV PATH_GF_HOME=/opt/glassfish
ENV GLASSFISH_DOWNLOAD_SHA512=1e1ad9412445f80c3f05a9902d81df179ca39920e6adad751b41bbda664ed69c86a7abce909692e2020ee93fd84d44958f1f072b932d774dddc5187fdf6a3323 \
GLASSFISH_VERSION=7.1.0 \
PATH_GF_JAR=${PATH_GF_HOME}/glassfish-embedded-all.jar

RUN true \
&& set -x \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y gpg unzip \
&& mkdir -p "${PATH_GF_HOME}" \
&& curl -fL "https://repo1.maven.org/maven2/org/glassfish/main/extras/glassfish-embedded-all/${GLASSFISH_VERSION}/glassfish-embedded-all-${GLASSFISH_VERSION}.jar.asc" -o glassfish-embedded-all.jar.asc \
&& curl -fL "https://repo1.maven.org/maven2/org/glassfish/main/extras/glassfish-embedded-all/${GLASSFISH_VERSION}/glassfish-embedded-all-${GLASSFISH_VERSION}.jar" -o "${PATH_GF_HOME}"/glassfish-embedded-all.jar \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys D4A77129F00F736293BE5A51AFC18A2271EDDFE1 \
&& gpg --batch --verify glassfish-embedded-all.jar.asc "${PATH_GF_HOME}"/glassfish-embedded-all.jar \
&& rm glassfish-embedded-all.jar.asc \
&& echo "$GLASSFISH_DOWNLOAD_SHA512 "${PATH_GF_HOME}"/glassfish-embedded-all.jar" | sha512sum --strict --check \
&& userdel -r ubuntu \
&& groupadd -g ${GID} glassfish \
&& useradd -r -l -u ${UID} -g ${GID} -d "${PATH_GF_HOME}" -s /bin/bash glassfish \
&& env | sort \
&& chown -R glassfish:glassfish "${PATH_GF_HOME}" \
&& mkdir ${PATH_GF_HOME}/autodeploy \
&& ln -s ${PATH_GF_HOME}/autodeploy /deploy \
&& echo "Installation was successful."

USER glassfish
WORKDIR ${PATH_GF_HOME}
ENTRYPOINT ["java", "-jar", "glassfish-embedded-all.jar"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
85 changes: 85 additions & 0 deletions images/server/7.1.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
FROM eclipse-temurin:21-jdk

LABEL org.opencontainers.image.base.name="eclipse-temurin:21-jdk"
LABEL org.opencontainers.image.source="https://github.com/eclipse-ee4j/glassfish.docker"
LABEL org.opencontainers.image.url="https://github.com/eclipse-ee4j/glassfish.docker/wiki"

LABEL org.opencontainers.image.title="Eclipse GlassFish"
LABEL org.opencontainers.image.description="The Official Eclipse GlassFish Docker Image"
LABEL org.opencontainers.image.version="7.1.0"

LABEL org.opencontainers.image.authors="glassfish-dev@eclipse.org"
LABEL org.opencontainers.image.vendor="Eclipse Foundation"
LABEL org.opencontainers.image.licenses="EPL-2.0"

EXPOSE 4848 9009 8080 8181 8686 3700 3820 3920 6666

# You should use own credentials and own files! These are just defaults.
ARG AS_ADMIN_PASSWORD=admin \
PATH_GF_PASSWORD_FILE_FOR_CHANGE=/password-change.txt \
UID=1000 \
GID=1000
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 \
AS_STOP_TIMEOUT=9500 \
GLASSFISH_DOWNLOAD_SHA512=843e5303e7369957ac251ffe326dba0a83f874894cc1983637ac8c2f52fab21f46bc49ce5c3c341d76263d8e9dad8ac53a5befcea69efe5f28f4b8083cfcf150 \
GLASSFISH_VERSION=7.1.0 \
PATH_GF_BIN=${PATH_GF_HOME}/bin \
PATH_GF_SERVER_LOG="${PATH_GF_HOME}/glassfish/domains/domain1/logs/server.log"
ENV PATH="${PATH_GF_BIN}:${PATH}"

RUN true \
&& set -x \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y gpg unzip \
&& curl -fL "https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/${GLASSFISH_VERSION}/glassfish-${GLASSFISH_VERSION}.zip.asc" -o glassfish.zip.asc \
&& curl -fL "https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/${GLASSFISH_VERSION}/glassfish-${GLASSFISH_VERSION}.zip" -o glassfish.zip \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys D4A77129F00F736293BE5A51AFC18A2271EDDFE1 \
&& gpg --batch --verify glassfish.zip.asc glassfish.zip \
&& rm glassfish.zip.asc \
&& echo "$GLASSFISH_DOWNLOAD_SHA512 glassfish.zip" | sha512sum --strict --check \
&& mkdir -p "${PATH_GF_HOME}" \
&& unzip -q glassfish.zip -d "${PATH_GF_HOME}/.." \
&& rm glassfish.zip \
&& userdel -r ubuntu \
&& groupadd -g ${GID} glassfish \
&& useradd -r -l -u ${UID} -g ${GID} -d "${PATH_GF_HOME}" -s /bin/bash glassfish \
&& echo "Generating password file at ${AS_PASSWORD_FILE} ..." \
&& set +x \
&& echo "AS_ADMIN_PASSWORD=${AS_ADMIN_PASSWORD}" > "${AS_PASSWORD_FILE}" \
&& chown glassfish:glassfish "${AS_PASSWORD_FILE}" \
&& echo "AS_ADMIN_PASSWORD=" > "${PATH_GF_PASSWORD_FILE_FOR_CHANGE}" \
&& echo "AS_ADMIN_NEWPASSWORD=${AS_ADMIN_PASSWORD}" >> "${PATH_GF_PASSWORD_FILE_FOR_CHANGE}" \
&& echo "" >> "${PATH_GF_PASSWORD_FILE_FOR_CHANGE}" \
&& unset AS_ADMIN_PASSWORD \
&& set -x \
&& env | sort \
&& AS_START_TIMEOUT=120000 asadmin start-domain \
&& curl -o /dev/null http://localhost:4848 \
&& 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 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}" \
&& ln -s "${PATH_GF_HOME}/glassfish/domains/domain1/autodeploy" /deploy \
&& echo "Installation was successful."

COPY --chmod=755 docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh

USER glassfish
WORKDIR ${PATH_GF_HOME}
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["startserv"]
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#!/bin/bash
set -e;
set -e

change_passwords () {
local PWD_FILE=/tmp/passwordfile
local COMMAND=
rm -rf $PWD_FILE

if [ x"${AS_ADMIN_PASSWORD}" != x ]; then
if [ "${AS_ADMIN_PASSWORD}" != "" ] && [ "${AS_ADMIN_PASSWORD}" != "admin" ]; then
echo -e "AS_ADMIN_PASSWORD=admin\nAS_ADMIN_NEWPASSWORD=${AS_ADMIN_PASSWORD}" >> $PWD_FILE
COMMAND="change-admin-password --passwordfile=${PWD_FILE}"
COMMAND="change-admin-password"
echo "AS_ADMIN_PASSWORD=${AS_ADMIN_PASSWORD}" > "${AS_PASSWORD_FILE}"
fi

if [ x"${AS_ADMIN_MASTERPASSWORD}" != x ]; then
if [ "${AS_ADMIN_MASTERPASSWORD}" != "" ] && [ "${AS_ADMIN_MASTERPASSWORD}" != "changeit" ]; then
echo -e "AS_ADMIN_MASTERPASSWORD=changeit\nAS_ADMIN_NEWMASTERPASSWORD=${AS_ADMIN_MASTERPASSWORD}" >> ${PWD_FILE}
COMMAND="${COMMAND}
change-master-password --passwordfile=${PWD_FILE} --savemasterpassword=true"
COMMAND="${COMMAND}\nchange-master-password --savemasterpassword=true"
fi

if [ x"${COMMAND}" != x ]; then
printf "${COMMAND}" | asadmin --interactive=false
if [ "${COMMAND}" != "" ]; then
echo -e "${COMMAND}" | asadmin --interactive=false --passwordfile=${PWD_FILE}
fi

rm -rf ${PWD_FILE}
history -c
}

change_passwords
Expand All @@ -36,29 +36,21 @@ if [ -f custom/init.asadmin ]; then
fi


if [ "$1" != 'asadmin' -a "$1" != 'startserv' -a "$1" != 'runembedded' ]; then
if [ "$1" != 'asadmin' -a "$1" != 'startserv' ]; then
exec "$@"
fi

if [ "$1" == 'runembedded' ]; then
shift 1
if [[ "$SUSPEND" == true ]]
then
JVM_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=9009 $JVM_OPTS"
elif [[ "$DEBUG" == true ]]
then
JVM_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9009 $JVM_OPTS"
fi
exec java $JVM_OPTS -jar glassfish/lib/embedded/glassfish-embedded-static-shell.jar "$@"
fi

CONTAINER_ALREADY_STARTED="CONTAINER_ALREADY_STARTED_PLACEHOLDER"
if [ ! -f "$CONTAINER_ALREADY_STARTED" ]
then
touch "$CONTAINER_ALREADY_STARTED" &&
rm -rf glassfish/domains/domain1/autodeploy/.autodeploystatus || true
fi

if [ "${AS_TRACE}" == true ]; then
env|sort
fi

if [ "$1" == 'startserv' ]; then
exec "$@"
fi
Expand All @@ -72,4 +64,4 @@ on_exit () {
}
trap on_exit EXIT

env|sort && "$@" & wait
"$@" & wait
3 changes: 3 additions & 0 deletions images/server/7.1.0/dockerlibfile-fragment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Tags: 7.1.0, 7.1.0-jdk17, 7.1.0-jdk17-eclipse-temurin
Architectures: amd64, arm64v8
Directory: 7.1.0
Loading