Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ec3b787
Update publish.yaml
YohannParis Sep 27, 2023
f07e69b
Update publish.yaml
YohannParis Sep 27, 2023
fad740f
Update publish.yaml
YohannParis Sep 27, 2023
2ceb025
Update publish.yaml
YohannParis Sep 27, 2023
65bf48d
generated text-reading
invalid-email-address Sep 27, 2023
f9304a1
Remove the random test file
YohannParis Sep 27, 2023
a4efc77
Update publish.yaml
YohannParis Sep 27, 2023
2e39c11
Update publish.yaml
YohannParis Sep 27, 2023
1c217bb
[Text Reading] Set `_JAVA_OPTIONS` to min. RAM requirements (#507)
myedibleenso Sep 28, 2023
895ffe9
Try to see if the git add --all works
YohannParis Sep 28, 2023
3537f47
Merge remote-tracking branch 'upstream/main' into yohannparis/skema-t…
YohannParis Sep 28, 2023
f691103
Update publish.yaml
YohannParis Sep 28, 2023
41075ae
try a git add --force
YohannParis Sep 28, 2023
67555f1
Update publish.yaml
YohannParis Sep 28, 2023
fc5554b
Revert sbt requirement for naming without slashes
YohannParis Sep 28, 2023
cb21017
generated text-reading
invalid-email-address Sep 28, 2023
c6afeb7
Update publish.yaml
YohannParis Sep 28, 2023
e878cf4
Merge branch 'yohannparis/skema-text-reading-workflow' of https://git…
YohannParis Sep 28, 2023
4d8468c
Update publish.yaml
YohannParis Sep 28, 2023
06a508e
generated text-reading
invalid-email-address Sep 28, 2023
15c1a55
change folder to git push
YohannParis Sep 28, 2023
9dffd01
Add the clean step to free space
YohannParis Sep 28, 2023
98034e0
Just push the docker folder
YohannParis Sep 28, 2023
ca086c9
remove target
YohannParis Sep 28, 2023
d50b08b
Select what we need to push to main
YohannParis Sep 28, 2023
8e53f76
generated text-reading Dockerfile
invalid-email-address Sep 28, 2023
befd1dc
generated text-reading
invalid-email-address Sep 28, 2023
3d03b9b
just the libraries
YohannParis Sep 28, 2023
028e1e3
Try to push in stages
YohannParis Oct 2, 2023
64d1d25
generated text-reading Dockerfile
invalid-email-address Oct 2, 2023
be6e1e9
multiple push system
YohannParis Oct 2, 2023
1bc2934
Update publish.yaml
YohannParis Oct 2, 2023
cdc803e
generated text-reading Dockerfile
invalid-email-address Oct 2, 2023
8e3d584
Add the webapp themselves
YohannParis Oct 2, 2023
c0435e4
generated text-reading Dockerfile
invalid-email-address Oct 2, 2023
6450d29
Try to simplify, one more time the whole process.
YohannParis Oct 2, 2023
b4475d4
Merge branch 'yohannparis/skema-text-reading-workflow' of https://git…
YohannParis Oct 2, 2023
57b0b41
generated text-reading Dockerfile
invalid-email-address Oct 2, 2023
e70f7d5
Separate the clulab
YohannParis Oct 2, 2023
d78a258
Merge branch 'yohannparis/skema-text-reading-workflow' of https://git…
YohannParis Oct 2, 2023
96b7d7e
generated text-reading Dockerfile
invalid-email-address Oct 2, 2023
5b055f1
let's not publish climate change
YohannParis Oct 2, 2023
ab6a0cc
generated text-reading Dockerfile
invalid-email-address Oct 2, 2023
f52c779
Try using LFS
YohannParis Oct 2, 2023
f69c43c
generated text-reading Dockerfile
invalid-email-address Oct 2, 2023
23ea090
Update publish.yaml
YohannParis Oct 2, 2023
ae9c723
Merge branch 'yohannparis/skema-text-reading-workflow' of https://git…
YohannParis Oct 2, 2023
a8200e8
generated text-reading Dockerfile
invalid-email-address Oct 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/lib/*.jar filter=lfs diff=lfs merge=lfs -text
83 changes: 77 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name: Build and Publish
on:
push:
branches: ['main']
branches: ['main', 'yohannparis/skema-text-reading-workflow']
tags: ['*']

jobs:
Expand Down Expand Up @@ -45,6 +45,10 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
lfs: true

- name: Checkout Git LFS objects
run: git lfs checkout

- name: Setup JDK (w/ SBT)
uses: actions/setup-java@v3
Expand All @@ -55,17 +59,84 @@ jobs:
- name: Generate Text Reading app and its Dockerfile
working-directory: ./skema/text_reading/scala
env:
APP_VERSION: steps.generate.outputs.tag
APP_VERSION: ${steps.generate.outputs.tag}
run: |
sbt "webapp/docker:stage"

- name: Push to main
# The Text Reading image is huge.
# We need to free up every last bit of space we can.
- name: Free disk space (aggressively)
# use fork with fix to https://github.com/jlumbroso/free-disk-space/issues/9
uses: kfir4444/free-disk-space@main
with:
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
tool-cache: false

- name: Git push Dockerfile
run: |
cd ${{ GITHUB_WORKSPACE }}
git config user.name github-actions
git config user.email github-actions@github.com
git commit -am "generated text-reading"
git push
git add --force skema/text_reading/scala/webapp/target/docker/stage/Dockerfile
git commit --message="generated text-reading Dockerfile"
git push --force
git add --force \
skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/README.md \
skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/bin/webapp \
skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/conf/* \
skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/share/*
git commit --amend --no-edit
git push --force

- name: Git push webapp.* libs
run: |
git add --force skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/lib/webapp.*
git commit --amend --no-edit
git push --force

- name: Git push com.* and org.apache.* libs
run: |
git add --force skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/lib/com.*
git commit --amend --no-edit
git push --force
git add --force skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/lib/org.apache.*
git commit --amend --no-edit
git push --force


- name: Add all /lib to Git LFS
run: |
git lfs track "skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/lib/*.jar"
git add .gitattributes
git commit --amend --no-edit
git push --force

- name: Git push org.clulab.* libs
run: |
git add --force skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/lib/org.clulab.*
git commit --amend --no-edit
git push --force

- name: Git push other org.* libs
run: |
git add --force skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/lib/org.*
git commit --amend --no-edit
git push --force

- name: Git push other libs
run: |
git add --force skema/text_reading/scala/webapp/target/docker/stage/skema/text_reading/webapp/app/lib/*
git commit --amend --no-edit
git push --force

- name: Git push other files
run: |
git add --force skema/text_reading/scala/webapp/target/docker/*
git commit --amend --no-edit
git push --force

bake:
needs:
Expand Down
9 changes: 4 additions & 5 deletions skema/text_reading/scala/webapp/docker.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ Docker / version := tag
// set our version based on our env variable
dockerEnvVars ++= Map(
"APP_VERSION" -> scala.util.Properties.envOrElse("APP_VERSION", "???"),
"APPLICATION_SECRET" -> "this-is-not-a-secure-key-please-change-me"
"APPLICATION_SECRET" -> "this-is-not-a-secure-key-please-change-me",
// NOTE: the expected min. RAM requirements
// FIXME: reduce RAM consumption $\le 8GB$
"_JAVA_OPTIONS" -> "-Xmx10g -Xms10g -Dfile.encoding=UTF-8"
)
dockerAdditionalPermissions += (DockerChmodType.UserGroupPlusExecute, app)
dockerChmodType := DockerChmodType.UserGroupWriteExecute
// dockerCmd := Seq(s"-Dhttp.port=$port")
dockerEntrypoint := Seq(app)
// This is now delegated to skema-webapp.env.
// dockerEnvVars := Map(
// "_JAVA_OPTIONS" -> "-Xmx16g -Xms16g -Dfile.encoding=UTF-8"
// )
dockerPermissionStrategy := DockerPermissionStrategy.MultiStage
dockerUpdateLatest := true

Expand Down
23 changes: 23 additions & 0 deletions skema/text_reading/scala/webapp/target/docker/stage/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM openjdk:8 as stage0
LABEL snp-multi-stage="intermediate"
LABEL snp-multi-stage-id="37f01625-686c-4a47-bba9-56359edaa5dd"
WORKDIR /skema/text_reading/webapp/app
COPY skema /skema
USER root
RUN ["chmod", "-R", "u=rwX,g=rwX", "/skema/text_reading/webapp/app"]
RUN ["chmod", "u+x,g+x", "/skema/text_reading/webapp/app/bin/webapp"]
RUN ["chmod", "u+x,g+x", "/skema/text_reading/webapp/app/bin/webapp"]

FROM openjdk:8
LABEL MAINTAINER="Keith Alcock <docker@keithalcock.com>"
USER root
RUN id -u nobody 1>/dev/null 2>&1 || (( getent group 0 1>/dev/null 2>&1 || ( type groupadd 1>/dev/null 2>&1 && groupadd -g 0 root || addgroup -g 0 -S root )) && ( type useradd 1>/dev/null 2>&1 && useradd --system --create-home --uid 1001 --gid 0 nobody || adduser -S -u 1001 -G root nobody ))
WORKDIR /skema/text_reading/webapp/app
COPY --from=stage0 --chown=nobody:root /skema/text_reading/webapp/app /skema/text_reading/webapp/app
ENV APP_VERSION="${steps.generate.outputs.tag}"
ENV APPLICATION_SECRET="this-is-not-a-secure-key-please-change-me"
ENV _JAVA_OPTIONS="-Xmx10g -Xms10g -Dfile.encoding=UTF-8"
RUN chmod 775 /skema/text_reading/webapp/app
USER 1001:0
ENTRYPOINT ["/skema/text_reading/webapp/app/bin/webapp"]
CMD []
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# webapp

To create the docker image, use `dockerizeWebapp` from the main project of `sbt`. The result should be a docker image `skema-webapp`. Then use `docker-compose up` to run the image with a configuration file similar to this:

`docker-compose.yml`

```
version: '3.2'
services:
skema-webapp:
image: skema-webapp:1.0.0
restart: unless-stopped
ports:
- 9005:9000
container_name: skema-webapp
environment:
secret: <secret>
SKEMA_HOSTNAME: skema.clulab.org
_JAVA_OPTIONS: -Xmx16g -Xms16g -Dfile.encoding=UTF-8
```

Alternatively, start the container manually with a long command like this:

```
docker run --restart unless-stopped -p 9005:9000 --name skema-webapp \
--env secret=<secret> --env SKEMA_HOSTNAME=skema.clulab.org \
--env _JAVA_OPTIONS="-Xmx16g -Xms16g -Dfile.encoding=UTF-8" \
skema-webapp:1.0.0
```

Do not forget to set the `<secret>`. Values for the SKEMA_HOSTNAME and the external port (9005) may also need to be adjusted.
Loading