diff --git a/.github/workflows/publish-openmrs-backend-docker-image.yml b/.github/workflows/publish-openmrs-backend-docker-image.yml index e7c2dcb..c766ed8 100644 --- a/.github/workflows/publish-openmrs-backend-docker-image.yml +++ b/.github/workflows/publish-openmrs-backend-docker-image.yml @@ -32,6 +32,13 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Java 11 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: 11 + server-id: openmrs-module-fhir2extension # Value of the distributionManagement/repository/id field of the pom.xml + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 @@ -49,3 +56,5 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + secret-files: | + "m2settings=~/.m2/settings.xml" diff --git a/backend/Dockerfile b/backend/Dockerfile index 2f2cc4d..c473d92 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 ### Dev Stage -FROM maven:3.8-amazoncorretto-8 AS dev +FROM maven:3.8-amazoncorretto-11 AS dev WORKDIR /openmrs_distro RUN mkdir -p /openmrs/distribution/openmrs_core/ @@ -11,7 +11,10 @@ COPY distro.properties ./ COPY module-create-users ./module-create-users # Build the distro, but only deploy from the amd64 build -RUN --mount=type=cache,target=/root/.m2 mvn clean install +RUN --mount=type=cache,target=/usr/share/maven/ref/repository --mount=type=secret,id=m2settings,target=/usr/share/maven/ref/settings-docker.xml \ + mvn -s /usr/share/maven/ref/settings-docker.xml \ + -Dmaven.repo.local=/usr/share/maven/ref/repository \ + clean install RUN cp /openmrs_distro/target/sdk-distro/web/openmrs.war /openmrs/distribution/openmrs_core/ diff --git a/docker-compose.yml b/docker-compose.yml index 8ff5f2d..b05d4fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,6 +30,8 @@ services: # image: ghcr.io/icrc/openmrs-distro-sso/openmrs-backend-2.5.13:latest build: context: backend + secrets: + - m2settings ports: - "5005:5005" restart: "unless-stopped" @@ -93,6 +95,10 @@ services: # KC_HOSTNAME: 10.0.2.2 command: ["start-dev"] +secrets: + m2settings: + file: $HOME/.m2/settings.xml + volumes: openmrs-data: ~ db-data: ~