content: ARG jdkImage
  
  FROM ${jdkImage}
  ARG version
  ARG baseDownloadUrl
  
  # Create a user and group used to launch processes
  # The user ID 1000 is the default for the first "regular" user on Fedora/RHEL,
  # so there is a high chance that this ID will be equal to the current user
  # making it easier to use volumes (no permission issues)
  RUN groupadd -r jboss -g 1001 && useradd -u 1001 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss && \
      chmod 755 /opt/jboss
  
  # Set the working directory to jboss' user home directory
  WORKDIR /opt/jboss
  
  # latest eclipse-temurin docker images have removed curl in favor of wget (https://github.com/adoptium/containers/issues/630)
  # but ibm-semeru-runtimes docker images lack wget
  RUN apt-get update && apt-get -y install wget
  
  # Specify the user which should be used to execute all commands below
  USER jboss
  
  # Set the WILDFLY_VERSION env variable
  ENV WILDFLY_VERSION=${version}
  ENV DOWNLOAD_URL=${baseDownloadUrl}.tar.gz
  ENV JBOSS_HOME /opt/jboss/wildfly
  
  USER root
  RUN echo curl -O -L $DOWNLOAD_URL
  # Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content
  # Make sure the distribution is available from a well-known place
  RUN cd $HOME \
      && wget -nv $DOWNLOAD_URL \
      && tar xf wildfly-$WILDFLY_VERSION.tar.gz \
      && mv $HOME/wildfly-$WILDFLY_VERSION $JBOSS_HOME \
      && rm wildfly-$WILDFLY_VERSION.tar.gz \
      && chown -R jboss:0 ${JBOSS_HOME} \
      && chmod -R g+rw ${JBOSS_HOME}
  
  # Ensure signals are forwarded to the JVM process correctly for graceful shutdown
  ENV LAUNCH_JBOSS_IN_BACKGROUND true
  
  USER jboss
  
  # Expose the ports we're interested in
  EXPOSE 8080
  
  # Set the default command to run on boot
  # This will boot WildFly in the standalone mode and bind to all interface
  CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0"]
  
  COPY app.war /opt/jboss/wildfly/standalone/deployments/
  