Akron | 042dc98 | 2023-01-25 17:18:13 +0100 | [diff] [blame] | 1 | # Use alpine linux as base image |
Akron | 63cd58b | 2024-09-04 09:46:41 +0200 | [diff] [blame] | 2 | FROM eclipse-temurin:22-jdk-alpine as builder |
Akron | 042dc98 | 2023-01-25 17:18:13 +0100 | [diff] [blame] | 3 | |
| 4 | # Copy repository respecting .dockerignore |
| 5 | COPY . /export |
| 6 | |
| 7 | WORKDIR /export |
| 8 | |
| 9 | RUN apk update && \ |
| 10 | apk add --no-cache git \ |
| 11 | maven |
| 12 | |
| 13 | RUN git config --global user.email "korap+docker@ids-mannheim.de" && \ |
| 14 | git config --global user.name "Docker" |
| 15 | |
| 16 | # Install Kalamar-Plugin-Export |
| 17 | RUN mkdir built && \ |
| 18 | git clone https://github.com/KorAP/Kalamar-Plugin-Export.git Kalamar-Plugin-Export && \ |
| 19 | cd Kalamar-Plugin-Export && \ |
| 20 | git checkout master && \ |
| 21 | mvn clean package |
| 22 | |
| 23 | # Package |
| 24 | RUN cd Kalamar-Plugin-Export && \ |
| 25 | find target/KalamarExportPlugin-*.jar -exec mv {} ../built/KalamarExportPlugin.jar ';' |
| 26 | |
| 27 | RUN apk del git \ |
| 28 | maven |
| 29 | |
| 30 | RUN cd ${M2_HOME} && rm -r .m2 |
| 31 | |
Akron | 63cd58b | 2024-09-04 09:46:41 +0200 | [diff] [blame] | 32 | FROM eclipse-temurin:22-jre-alpine |
Akron | 042dc98 | 2023-01-25 17:18:13 +0100 | [diff] [blame] | 33 | |
| 34 | RUN addgroup -S korap && \ |
| 35 | adduser -S export -G korap && \ |
| 36 | mkdir export && \ |
| 37 | chown -R export.korap /export |
| 38 | |
| 39 | WORKDIR /export |
| 40 | |
| 41 | COPY --from=builder /export/built/KalamarExportPlugin.jar /export/ |
| 42 | |
| 43 | USER export |
| 44 | |
| 45 | EXPOSE 7777 |
| 46 | |
| 47 | ENTRYPOINT [ "java", "-jar" ] |
| 48 | |
| 49 | CMD [ "KalamarExportPlugin.jar" ] |
| 50 | |
| 51 | |
| 52 | # docker build -f Dockerfile -t korap/kalamar-plugin-export:{nr} . |