Skip to content

Commit

Permalink
Multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalLike committed Sep 18, 2024
1 parent 8c2ef53 commit 324610e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
architecture: x64
cache: maven

- run: mvn install --batch-mode --update-snapshots -DskipTests

- run: mkdir staging && cp web/target/geonetwork.war staging

- name: Log in to the Container registry
- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -55,7 +44,7 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with:
context: ./georoma
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
16 changes: 13 additions & 3 deletions georoma/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#
# Build stage
#
FROM maven:3.6.0-jdk-11-slim AS build
COPY ./ /home/app
RUN mvn -f /home/app/pom.xml clean install

#
# Package stage
#
FROM tomcat:8.5-jdk11

ENV GN_FILE geonetwork.war
Expand All @@ -17,17 +27,17 @@ RUN apt-get -y update && \
curl \
unzip

COPY ./staging/geonetwork.war geonetwork.war
COPY --from=build /home/app/web/target/geonetwork.war geonetwork.war

RUN mkdir -p geonetwork && \
unzip -e $GN_FILE -d geonetwork && \
rm $GN_FILE

# To enable AJP and support for traefik headers
COPY ./server.xml $CATALINA_HOME/conf/server.xml
COPY ./georoma/server.xml $CATALINA_HOME/conf/server.xml

#Set geonetwork data dir
COPY ./docker-entrypoint.sh /entrypoint.sh
COPY ./georoma/docker-entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

Expand Down

0 comments on commit 324610e

Please sign in to comment.