Skip to content

Commit

Permalink
Merge pull request #162 from research-software-directory/docker-impro…
Browse files Browse the repository at this point in the history
…vements

Docker improvements
  • Loading branch information
ewan-escience authored Mar 21, 2022
2 parents 68b259c + 8a6b9ad commit 5eab4cd
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 33 deletions.
14 changes: 9 additions & 5 deletions authentication/dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM maven:3.8.3-openjdk-17
FROM maven:3.8.4-openjdk-17 AS builder
WORKDIR /usr/mymaven
RUN mkdir --parents ./src/main
COPY pom.xml .
RUN mvn clean package -Dmaven.main.skip -Dmaven.test.skip && rm -r ./target && mvn exec:java --fail-never
COPY src/main ./src/main
RUN mvn compile
CMD mvn exec:java
RUN mvn dependency:go-offline
COPY ./src/main ./src/main
RUN mvn package --offline

FROM openjdk:17.0.2-jdk-slim-bullseye
WORKDIR /usr/myjava
COPY --from=builder /usr/mymaven/target/*-jar-with-dependencies.jar auth.jar
CMD java -cp auth.jar nl.esciencecenter.rsd.authentication.Main
37 changes: 28 additions & 9 deletions authentication/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,33 @@

<build>
<plugins>
<!-- https://mvnrepository.com/artifact/org.codehaus.mojo/exec-maven-plugin -->
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-dependency-plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
</plugin>

<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>

<configuration>
<mainClass>nl.esciencecenter.rsd.authentication.Main</mainClass>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>

<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand All @@ -34,22 +53,22 @@
<!-- https://mvnrepository.com/artifact/io.javalin/javalin-bundle -->
<dependency>
<groupId>io.javalin</groupId>
<artifactId>javalin-bundle</artifactId>
<version>4.1.1</version>
<artifactId>javalin</artifactId>
<version>4.3.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.18.2</version>
<version>3.19.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<version>2.9.0</version>
</dependency>
</dependencies>
</project>
6 changes: 3 additions & 3 deletions backend-postgrest/tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
database:
container_name: database-test
build: ../../database
image: rsd/database-test:0.0.3
image: rsd/database-test:0.0.4
ports:
# enable connection from outside
- "5432:5432"
Expand All @@ -23,7 +23,7 @@ services:
backend:
container_name: backend-test
build: ../
image: rsd/backend-postgrest-test:0.0.3
image: rsd/backend-postgrest-test:0.0.4
ports:
# enable connection from outside
- "3500:3500"
Expand All @@ -44,7 +44,7 @@ services:
context: .
# dockerfile to use for build
dockerfile: ./dockerfile
image: rsd/auth-test:0.0.2
image: rsd/auth-test:0.0.4
environment:
- PGRST_JWT_SECRET=normaly_this_is_a_secret_string_that_none_knows_BUT_this_is_just_a_test
- POSTGREST_URL=http://backend:3500
Expand Down
4 changes: 2 additions & 2 deletions backend-postgrest/tests/dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:17.3.0-alpine3.14
FROM node:17.7.1-alpine3.14
WORKDIR /usr/app
RUN npm install newman@5.3.0 wait-on@6.0.0
RUN npm install newman@5.3.2 wait-on@6.0.1
COPY ./RSD-SaaS-auth.postman_collection.json /usr/app
CMD npx wait-on --timeout 10000 $POSTGREST_URL && npx newman run RSD-SaaS-auth.postman_collection.json --global-var "backend_url=$POSTGREST_URL" --global-var "jwt_secret=$PGRST_JWT_SECRET"
2 changes: 1 addition & 1 deletion data-migration/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
build:
context: ../
dockerfile: ./data-migration/dockerfile
image: rsd/data-migration:0.0.9
image: rsd/data-migration:0.0.10
env_file:
# use main env file
- ../.env
Expand Down
2 changes: 1 addition & 1 deletion data-migration/dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3.8.3-openjdk-17
FROM maven:3.8.4-openjdk-17
WORKDIR /usr/mymaven
RUN mkdir --parents ./src/main
COPY data-migration/pom.xml .
Expand Down
4 changes: 2 additions & 2 deletions data-migration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<version>2.9.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.18.2</version>
<version>3.19.0</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion database/dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM postgres:14.1
FROM postgres:14.2
COPY *.sql /docker-entrypoint-initdb.d/
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
database:
container_name: database
build: ./database
image: rsd/database:0.0.12
image: rsd/database:0.0.13
ports:
# enable connection from outside (development mode)
- "5432:5432"
Expand All @@ -24,7 +24,7 @@ services:
backend:
container_name: backend
build: ./backend-postgrest
image: rsd/backend-postgrest:0.0.1
image: rsd/backend-postgrest:0.0.2
expose:
- 3500
environment:
Expand All @@ -42,7 +42,7 @@ services:
auth:
container_name: auth
build: ./authentication
image: rsd/auth:0.0.5
image: rsd/auth:0.0.6
expose:
- 7000
environment:
Expand Down Expand Up @@ -87,7 +87,7 @@ services:
scrapers:
container_name: scrapers
build: ./scrapers
image: rsd/scrapers:0.0.3
image: rsd/scrapers:0.0.4
environment:
# it uses values from .env file
- POSTGREST_URL
Expand Down
4 changes: 2 additions & 2 deletions scrapers/dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM maven:3.8.3-openjdk-17 AS builder
FROM maven:3.8.4-openjdk-17 AS builder
WORKDIR /usr/mymaven
RUN mkdir --parents ./src/main
COPY pom.xml .
RUN mvn dependency:go-offline
COPY ./src/main ./src/main
RUN mvn package --offline

FROM openjdk:17.0-jdk-slim-bullseye
FROM openjdk:17.0.2-jdk-slim-bullseye
WORKDIR /usr/myjava
RUN apt-get update && apt-get --yes install cron python pip nano
COPY --from=builder /usr/mymaven/src/main/resources/requirements.txt requirements.txt
Expand Down
6 changes: 3 additions & 3 deletions scrapers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</plugin>

<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
Expand Down Expand Up @@ -53,14 +53,14 @@
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.18.2</version>
<version>3.19.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<version>2.9.0</version>
</dependency>
</dependencies>
</project>

0 comments on commit 5eab4cd

Please sign in to comment.