Skip to content

Commit

Permalink
Merge branch 'master' into raw-iris-in-templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesaoverton committed Oct 29, 2024
2 parents e51d9cb + a9be72d commit b82e88b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/java-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: mvn verify
- name: Upload Artifact
if: ${{ matrix.java == 11 }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: robot.jar
path: bin/robot.jar
Expand Down
33 changes: 27 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
FROM maven:3-openjdk-11-slim
# Stage 1: Build the application using Maven
FROM maven:3-openjdk-11-slim AS build

# Create a working directory and set permissions
RUN useradd -m robot
RUN mkdir -p /usr/src/app
RUN chown robot /usr/src/app

WORKDIR /usr/src/app

# Copy the POM and source code to the working directory
COPY pom.xml /usr/src/app
COPY robot-command /usr/src/app/robot-command
COPY robot-core /usr/src/app/robot-core
COPY robot-maven-plugin /usr/src/app/robot-maven-plugin
COPY bin/robot /usr/local/bin/
COPY robot-mock-plugin /usr/src/app/robot-mock-plugin

# Change ownership to robot user
RUN chown -R robot:robot /usr/src/app

# Use the robot user to run Maven
USER robot
WORKDIR /usr/src/app

# Run the Maven build, skipping tests to speed up the process
RUN mvn install -DskipTests

USER root
RUN cp bin/robot.jar /usr/local/bin
# Stage 2: Create a smaller runtime container
FROM openjdk:11-jre-slim AS runtime

# Create a non-root user and set up a working directory
RUN useradd -m robot
RUN mkdir -p /usr/src/app/bin
RUN chown robot /usr/src/app/bin

# Copy the compiled JAR file from the build stage to the runtime stage
COPY --from=build /usr/src/app/bin/robot.jar /usr/src/app/bin/robot.jar

# Set robot as the user
USER robot
ENTRYPOINT ["robot"]

# Set the entrypoint to run the robot.jar
ENTRYPOINT ["java", "-jar", "/usr/src/app/bin/robot.jar"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Other build options:
- `mvn clean verify` rebuilds the package and runs integration tests against it, with reports in `[module]/target/failsafe-reports`
- `mvn site` generates Javadoc in `target/site` and `[module]/target/site`

Alternatively, you can use [Docker](https://www.docker.com) with the provided [Dockerfile](Dockerfile) to build and run ROBOT from within a container. First build an image with `docker build --tag robot .` then run ROBOT from the container with the usual command-line arguments: `docker run --rm robot --help`.
Alternatively, you can use [Docker](https://www.docker.com) with the provided [Dockerfile](Dockerfile) to build and run ROBOT from within a container. First build an image with `docker build --tag robot:latest .` then run ROBOT from the container with the usual command-line arguments: `docker run --rm robot --help`.


## Code Style
Expand Down
2 changes: 1 addition & 1 deletion robot-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
<dependency>
<groupId>org.geneontology</groupId>
<artifactId>whelk-owlapi_${scala.version}</artifactId>
<version>1.1.3</version>
<version>1.2.1</version>
<exclusions>
<exclusion>
<groupId>net.sourceforge.owlapi</groupId>
Expand Down

0 comments on commit b82e88b

Please sign in to comment.