diff --git a/.dockerignore b/.dockerignore index 5ae5188a..3e0e666f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,9 +1,4 @@ .github .idea -LICENSE -README.ms -docs -target/** +target/ !target/fdp-spring-boot.jar -!target/classes/application-production.yml -nb-configuration.xml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index a9537a03..684086c0 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,9 +1,13 @@ name: Publish to Docker Hub on: + push: + branches: + - develop pull_request: release: - types: [created] + types: + - created concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -20,5 +24,5 @@ jobs: uses: FAIRDataTeam/github-workflows/.github/workflows/docker-publish.yml@v2 secrets: inherit with: - file: './Dockerfile.build' - push: ${{ github.event_name == 'release' && github.event.action == 'created' }} + file: './Dockerfile' + push: ${{ github.event_name == 'push' || github.event_name == 'release' }} diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 04e0dd99..e1789e1c 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -92,7 +92,7 @@ jobs: - name: Docker build run: | docker pull $PUBLIC_IMAGE:$TAG_DEVELOP - docker build --cache-from $PUBLIC_IMAGE:$TAG_DEVELOP -t fdp:snyk-test -f Dockerfile.build . + docker build --cache-from $PUBLIC_IMAGE:$TAG_DEVELOP -t fdp:snyk-test -f Dockerfile . - name: Perform Snyk Check (Docker) uses: snyk/actions/docker@master diff --git a/CHANGELOG.md b/CHANGELOG.md index ca291bb6..113816a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,21 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed -- Switched to Java 21 (LTS) +- Update to Java 21 by @MarekSuchanek in #471 +- ??? (TODO) +- Get FAIR Data Team dependencies from Maven Central repository by @dennisvang in #577 +- Fix issue templates by @dennisvang in #582 +- Update CORS configuration by @dennisvang in #578 +- Separate and reuse github workflows by @dennisvang in #617 +- Prevent duplicate workflow runs by @dennisvang in #628 +- Clean up Dockerfile by @dennisvang in #626 +## [1.17.2] + +### Fixed + +- Fix metadata schemas (defaults, ordering, FDP shape) +- Default license in metadata schemas and configuration ## [1.17.1] @@ -381,3 +394,4 @@ The first release of reference FAIR Data Point implementation. [1.16.2]: /../../tree/v1.16.2 [1.17.0]: /../../tree/v1.17.0 [1.17.1]: /../../tree/v1.17.1 +[1.17.2]: /../../tree/v1.17.2 diff --git a/Dockerfile b/Dockerfile index 25121565..ec1a9fb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,30 @@ -# -# The MIT License -# Copyright © 2016-2024 FAIR Data Team -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +# https://docs.docker.com/reference/dockerfile/#syntax +# syntax=docker/dockerfile:1 + +################################################################################ +# BUILD JAR + +FROM maven:3-eclipse-temurin-21-alpine AS builder + +WORKDIR /builder + +ADD . /builder + +# https://maven.apache.org/ref/current/maven-embedder/cli.html +RUN mvn --quiet --batch-mode --update-snapshots --fail-fast -DskipTests package + +################################################################################ +# BUILD IMAGE FROM eclipse-temurin:21-jdk-alpine +# add non-root user to run the app +# https://spring.io/guides/gs/spring-boot-docker +RUN addgroup -S spring && adduser -S spring -G spring +USER spring:spring + WORKDIR /fdp -ADD target/fdp-spring-boot.jar /fdp/app.jar -ADD target/classes/application-production.yml /fdp/application.yml +COPY --from=builder /builder/target/fdp-spring-boot.jar /fdp/app.jar -ENTRYPOINT java -jar app.jar --spring.profiles.active=production --spring.config.location=classpath:/application.yml,classpath:/application-production.yml,file:/fdp/application.yml +ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/Dockerfile.build b/Dockerfile.build deleted file mode 100644 index 85aeb819..00000000 --- a/Dockerfile.build +++ /dev/null @@ -1,42 +0,0 @@ -# -# The MIT License -# Copyright © 2024 FAIR Data Team -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -################################################################################ -# BUILD STAGE -FROM maven:3-eclipse-temurin-21-alpine as builder - -WORKDIR /builder - -ADD . /builder - -RUN mvn -q -B -U -ff -DskipTests package - -################################################################################ -# RUN STAGE -FROM eclipse-temurin:21-jdk-alpine - -WORKDIR /fdp - -COPY --from=builder /builder/target/fdp-spring-boot.jar /fdp/app.jar -COPY --from=builder /builder/target/classes/application-production.yml /fdp/application.yml - -ENTRYPOINT java -jar app.jar --spring.profiles.active=production --spring.config.location=classpath:/application.yml,classpath:/application-production.yml,file:/fdp/application.yml diff --git a/README.md b/README.md index b25e76e2..2bfcfbbd 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ If you do not have Java and Maven locally, you can build the Docker image using built `jar` file): ```bash -$ docker build -f Dockerfile.build -t fairdatapoint:local . +$ docker build -f Dockerfile -t fairdatapoint:local . ``` ## Security diff --git a/pom.xml b/pom.xml index f03aba8f..c3369eaa 100644 --- a/pom.xml +++ b/pom.xml @@ -271,7 +271,7 @@ **/*.json LICENSE .dockerignore - Dockerfile.build + Dockerfile diff --git a/src/main/java/org/fairdatapoint/config/RepositoryConfig.java b/src/main/java/org/fairdatapoint/config/RepositoryConfig.java index c71a496c..6a5455b8 100644 --- a/src/main/java/org/fairdatapoint/config/RepositoryConfig.java +++ b/src/main/java/org/fairdatapoint/config/RepositoryConfig.java @@ -59,7 +59,7 @@ public Repository mainRepository(ApplicationContext context) throws RepositoryEx @Bean(initMethod = "init", destroyMethod = "shutDown", name = "draftsRepository") public Repository draftsRepository(ApplicationContext context) throws RepositoryException { - return prepareRepository(context, repositoryProperties.getMain()); + return prepareRepository(context, repositoryProperties.getDrafts()); } public Repository prepareRepository(ApplicationContext context, RepositoryConnectionProperties properties)