diff --git a/services/git-bridge/.dockerignore b/services/git-bridge/.dockerignore index e49947d0fd..7023d49b46 100644 --- a/services/git-bridge/.dockerignore +++ b/services/git-bridge/.dockerignore @@ -1,4 +1,6 @@ * +!start.sh +!/conf !/lib !/src/main !/pom.xml diff --git a/services/git-bridge/Dockerfile b/services/git-bridge/Dockerfile index 341535c451..be5d498e9f 100644 --- a/services/git-bridge/Dockerfile +++ b/services/git-bridge/Dockerfile @@ -21,14 +21,19 @@ RUN make package \ FROM openjdk:8-jre -RUN apt-get update && apt-get install -y git \ +RUN apt-get update && apt-get install -y git gettext-base\ && rm -rf /var/lib/apt/lists RUN useradd --create-home node -ENTRYPOINT ["java", "-jar", "/git-bridge.jar"] -CMD ["/conf/runtime.json"] +CMD ["/start.sh"] COPY --from=builder /git-bridge.jar / +COPY conf/envsubst_template.json envsubst_template.json +COPY start.sh start.sh + +RUN mkdir conf +RUN chown node:node conf + USER node diff --git a/services/git-bridge/conf/envsubst_template.json b/services/git-bridge/conf/envsubst_template.json new file mode 100644 index 0000000000..4c0b612523 --- /dev/null +++ b/services/git-bridge/conf/envsubst_template.json @@ -0,0 +1,32 @@ +{ + "port": 8080, + "rootGitDirectory": "/tmp/wlgb", + "apiBaseUrl": "https://localhost/api/v0", + "username": "$GITBRIDGE_USERNAME", + "password": "$GITBRIDGE_PASSWORD", + "postbackBaseUrl": "https://localhost", + "serviceName": "Overleaf", + "oauth2": { + "oauth2ClientID": "$GITBRIDGE_OAUTH2_CLIENT_ID", + "oauth2ClientSecret": "$GITBRIDGE_OAUTH2_CLIENT_SECRET", + "oauth2Server": "https://localhost" + }, + "repoStore": { + "maxFileNum": 2000, + "maxFileSize": 52428800 + }, + "swapStore": { + "type": "s3", + "awsAccessKey": "asdf", + "awsSecret": "asdf", + "s3BucketName": "com.overleaf.testbucket", + "awsRegion": "us-east-1" + }, + "swapJob": { + "minProjects": 50, + "lowGiB": 128, + "highGiB": 256, + "intervalMillis": 3600000, + "compressionMethod": "gzip" + } +} diff --git a/services/git-bridge/start.sh b/services/git-bridge/start.sh new file mode 100755 index 0000000000..0ecf2bf778 --- /dev/null +++ b/services/git-bridge/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash +envsubst < /envsubst_template.json > /conf/runtime.json +java -jar /git-bridge.jar /conf/runtime.json