Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
Docker image now uses the Micronaut functions
Browse files Browse the repository at this point in the history
  • Loading branch information
agarciadom committed Dec 2, 2024
1 parent adf4677 commit e88e51c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
- name: Download the backend JAR
run: mvn -B dependency:copy-dependencies -DexcludeTransitive=true && ls target/dependency
- name: Build the Docker image
run: docker build --tag playground-docker:$(date +%s) .
run: docker build --tag playground-docker:micronaut .
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
FROM bitnami/git AS git_clones

# Clone the Epsilon Playground repo that contains the back-end
RUN git clone --depth=1 https://github.com/epsilonlabs/playground

# Clone the Epsilon website repo that contains the front-end
RUN git clone --depth=1 https://github.com/eclipse/epsilon-website epsilon

Expand All @@ -20,17 +17,17 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# Copy playground sources
COPY --from=git_clones /playground/ /playground/
COPY --from=git_clones /epsilon/mkdocs/docs/playground/ /etc/nginx/html/

# Redirect /services/ URLs to the backend services running on ports 8001-8003
# Create directory for playground all-in-one JAR
RUN mkdir -p /opt/playground
COPY ./target/dependency/http-server-*-all.jar /opt/playground/backend.jar

# Redirect /services/ URLs to the backend services running on port 8080
ADD ./nginx.conf.template /etc/nginx.conf.template

WORKDIR /playground

# Build fat jar with all services and dependencies
RUN mvn package

# Copy start script and make it executable
ADD start.sh /
RUN chmod +x /start.sh
Expand Down
6 changes: 3 additions & 3 deletions nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ server {
listen ${PORT};

location /services/RunEpsilonFunction {
proxy_pass http://127.0.0.1:8001/;
proxy_pass http://127.0.0.1:8080/epsilon;
}

location /services/FlexmiToPlantUMLFunction {
proxy_pass http://127.0.0.1:8002/;
proxy_pass http://127.0.0.1:8080/flexmi2plantuml;
}

location /services/EmfaticToPlantUMLFunction {
proxy_pass http://127.0.0.1:8003/;
proxy_pass http://127.0.0.1:8080/emfatic2plantuml;
}
}
10 changes: 2 additions & 8 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,8 @@ wait_for_service() {
}

# Functions for running Epsilon
java -cp target/org.eclipse.epsilon.playground.jar com.google.cloud.functions.invoker.runner.Invoker --target org.eclipse.epsilon.playground.RunEpsilonFunction --port 8001 &
wait_for_service Epsilon 127.0.0.1 8001

java -cp target/org.eclipse.epsilon.playground.jar com.google.cloud.functions.invoker.runner.Invoker --target org.eclipse.epsilon.playground.FlexmiToPlantUMLFunction --port 8002 &
wait_for_service Flexmi 127.0.0.1 8002

java -cp target/org.eclipse.epsilon.playground.jar com.google.cloud.functions.invoker.runner.Invoker --target org.eclipse.epsilon.playground.EmfaticToPlantUMLFunction --port 8003 &
wait_for_service Emfatic 127.0.0.1 8003
java -jar /opt/playground/backend.jar &
wait_for_service Epsilon 127.0.0.1 8080

# nginx as frontend + reverse proxy
envsubst < /etc/nginx.conf.template > /etc/nginx/conf.d/default.conf
Expand Down

0 comments on commit e88e51c

Please sign in to comment.