Skip to content

Commit

Permalink
change dockerfile to multistep build
Browse files Browse the repository at this point in the history
  • Loading branch information
alekszivko committed Feb 3, 2025
1 parent 0d52968 commit ef9037c
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
FROM quay.io/wildfly/wildfly:latest-jdk21

ADD gamertrack-war/target/gepardec-gamertrack.war /opt/jboss/wildfly/standalone/deployments/

COPY ChangeDataSource.sh /opt/jboss/wildfly/ChangeDataSource.sh
FROM quay.io/wildfly/wildfly:latest-jdk21 AS build

USER root
WORKDIR /opt/jboss/wildfly/bin

RUN chmod +x /opt/jboss/wildfly/ChangeDataSource.sh
RUN chmod -R 777 /opt/jboss/
RUN ./jboss-cli.sh --commands="embed-server --std-out=echo --server-config=standalone.xml, /subsystem=datasources/data-source=ExampleDS:write-attribute(name=connection-url, value=\"jdbc:h2:file:/opt/jboss/wildfly/gamertrackDB;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=\${wildfly.h2.compatibility.mode:REGULAR}\")"

USER jboss

RUN /opt/jboss/wildfly/ChangeDataSource.sh

USER root
RUN chmod -R 777 /opt/jboss/wildfly
USER jboss
FROM quay.io/wildfly/wildfly:latest-jdk21
COPY --from=build /opt/jboss/wildfly/standalone/configuration/standalone.xml /opt/jboss/wildfly/standalone/configuration/standalone.xml
ADD gamertrack-war/target/gepardec-gamertrack.war /opt/jboss/wildfly/standalone/deployments/


ENTRYPOINT ["/bin/bash", "-c", "/opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0"]

0 comments on commit ef9037c

Please sign in to comment.