Skip to content

Commit

Permalink
Adding licenses and other files to Docker images.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Gougeon committed Oct 30, 2024
1 parent d1287ee commit 60b9daa
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 28 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,5 +297,7 @@ Additionally, you can find the OpenECPDS options for various editors at this lin
This project automates the downloading of specific tools (GraalVM, Maven, Docker, Kompose, Kubectl). Additionally, it uses external APIs that are downloaded via Maven. For licenses and details on these dependencies, please refer to their respective documentation. You can retrieve the licenses from the development container using:

```bash
mvn dependency:copy-dependencies
make get-licenses
```

If successful, the licenses will be available in the `target/generated-resources` directory. These licenses are also included in the root directory of the container images, along with the `AUTHORS`, `LICENSE.txt`, `NOTICE` and `VERSION` files.
21 changes: 14 additions & 7 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ RESET := \033[0m
DOCKER_HOST_OS ?= $(shell uname -s)
DOCKER_GUEST_OS := $(shell uname -s)

# How to get the rpms?
COPY := cp ../target/rpm
# Source directories for the rpms and licences
RPM_DIR := ../target/rpm
LICENSES_DIR := ../target/generated-resources

# Detect container manager (Docker or Podman)
ifeq ($(shell command -v podman 2> /dev/null),)
Expand All @@ -45,30 +46,35 @@ DOCKER_VERSION := $(shell $(DOCKER) --version)
HTTPS_ACCESS := $(shell curl -s --max-time 2 -I https://google.com | sed 's/^[^ ]* *\([0-9]\).*/\1/; 1q')

# Output the help for each task
.PHONY: help all get-rpms build images bk-images rm-images clean .clean info
.PHONY: help all get-rpms get-licenses build images bk-images rm-images clean .clean info

help: ## Show this help message
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

# Display help by default
.DEFAULT_GOAL := help

all: ## Get RPMs, and build images
all: ## Get RPMs, licenses and build images
@$(MAKE) get-rpms
@$(MAKE) get-licenses
@$(MAKE) build

.https-access: ## Check HTTPS access (required to build images)
@if [ "$(HTTPS_ACCESS)" != "2" -a "$(HTTPS_ACCESS)" != "3" ]; then \
printf "$(RED)** HTTPS connectivity is down **$(RESET)\n" && exit 1; \
fi

get-rpms: ## Get RPMs from the RPMS directory in rpmbuild
get-rpms: ## Get RPMs from the source RPM directories
@$(MAKE) .get-rpm app=mover rpm=mover arch=noarch
@$(MAKE) .get-rpm app=master rpm=master arch=noarch
@$(MAKE) .get-rpm app=monitor rpm=monitor arch=noarch

.get-rpm: # Create the target directory and get the specified RPM (args: app, rpm, arch)
mkdir -p ecpds/$(app)/rpms && $(COPY)/ecpds-$(rpm)/RPMS/$(arch)/ecpds-$(rpm)-$(TAG).$(arch).rpm ecpds/$(app)/rpms/.
mkdir -p ecpds/$(app)/rpms && cp -f $(RPM_DIR)/ecpds-$(rpm)/RPMS/$(arch)/ecpds-$(rpm)-$(TAG).$(arch).rpm ecpds/$(app)/rpms/.

get-licenses: ## Get the licenses for the java image
cp -fr $(LICENSES_DIR)/licenses* ecpds/java/.
cp -f ../AUTHORS ../LICENSE.txt ../NOTICE ../VERSION ecpds/java/.

build: .https-access ## Build database, Java, and service images
@$(MAKE) .build app=database tag=$(TAG)
Expand Down Expand Up @@ -118,10 +124,11 @@ push: .checkcr ## Push images to CR
$(DOCKER) push $(CR_URL)/$(app):$(tag)
$(DOCKER) push $(CR_URL)/$(app)

clean: ## Remove all RPMs
clean: ## Remove all RPMs and licenses
@$(MAKE) .clean app=mover
@$(MAKE) .clean app=master
@$(MAKE) .clean app=monitor
cd ecpds/java && rm -fr AUTHORS LICENSE.txt NOTICE VERSION licenses*

.clean: # Remove RPMs for the specified app (arg: app)
rm -f ecpds/$(app)/rpms/ecpds-*-*.*.rpm
Expand Down
6 changes: 6 additions & 0 deletions docker/ecpds/java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AUTHORS
LICENSE.txt
NOTICE
VERSION
licenses.xml
licenses
4 changes: 4 additions & 0 deletions docker/ecpds/java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ RUN java -Xshare:dump

# Re-enable disabled algorithms to allow connecting to low security sites
COPY java.security $JAVA_HOME/conf/security/.

# Copy licences and related files
COPY AUTHORS LICENSE.txt NOTICE VERSION licenses.xml .
COPY licenses /licenses
51 changes: 31 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
<groupId>ecmwf</groupId>
<artifactId>product-data-store</artifactId>
<version>6.7.9</version>
<name>Product Data Store (PDS)</name>
<name>Product Data Store (OpenECPDS)</name>
<description>Product Data Store for Acquisition and Dissemination activities</description>
<url>
https://www.ecmwf.int/en/newsletter/159/computing/ecmwf-production-data-store</url>
<url>https://github.com/ecmwf/open-ecpds</url>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -213,23 +212,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<failOnBlacklist>true</failOnBlacklist>
<includedLicenses>
<includedLicense>Apache-2.0</includedLicense>
</includedLicenses>
<licenseName>apache_v2</licenseName>
<organizationName>ECMWF</organizationName>
<inceptionYear>2004</inceptionYear>
<includes>
<include>**/*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand All @@ -252,6 +234,35 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.4.0</version>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.24.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.24.0</version>
</dependency>
</dependencies>
<configuration>
<errorRemedy>ignore</errorRemedy>
</configuration>
<executions>
<execution>
<id>download-licenses</id>
<phase>prepare-package</phase>
<goals>
<goal>download-licenses</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
Expand Down

0 comments on commit 60b9daa

Please sign in to comment.