Просмотр исходного кода

[docker] build the git-bridge in docker

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
Jakob Ackermann 7 лет назад
Родитель
Сommit
2ebae69044
3 измененных файлов с 43 добавлено и 11 удалено
  1. 4 0
      services/git-bridge/.dockerignore
  2. 18 1
      services/git-bridge/Dockerfile
  3. 21 10
      services/git-bridge/README.md

+ 4 - 0
services/git-bridge/.dockerignore

@@ -0,0 +1,4 @@
+*
+!/lib
+!/src/main
+!/pom.xml

+ 18 - 1
services/git-bridge/Dockerfile

@@ -13,4 +13,21 @@ RUN apt-get update && \
 
 
 RUN mkdir /app
-WORKDIR /app
+WORKDIR /app
+
+COPY . /app
+RUN mvn clean package \
+# The name of the created jar contains the current version tag.
+# Rename it to a static path that can be used for copying.
+&&  find /app/target \
+      -name 'writelatex-git-bridge*jar-with-dependencies.jar' \
+      -exec mv {} /git-bridge.jar \;
+
+FROM openjdk:8-jre
+
+USER www-data
+
+ENTRYPOINT ["java", "-jar", "/git-bridge.jar"]
+CMD ["/conf/runtime.json"]
+
+COPY --from=0 /git-bridge.jar /

+ 21 - 10
services/git-bridge/README.md

@@ -1,13 +1,26 @@
-writelatex-git-bridge
-=====================
+# writelatex-git-bridge
+
+## Docker
+
+The `Dockerfile` contains all the requirements for building and running the
+ writelatex-git-bridge.
+
+```bash
+# build the image
+docker build -t writelatex-git-bridge .
+
+# run it with the demo config
+docker run -v `pwd`/conf/local.json:/conf/runtime.json writelatex-git-bridge
+```
+
+## Native install
+
+### Required packages
 
-Required
---------
   * `maven` (for building, running tests and packaging)
   * `jdk-8` (for compiling and running)
 
-Commands
---------
+### Commands
 
 To be run from the base directory:
 
@@ -20,8 +33,7 @@ To be run from the base directory:
 **Clean**:
 `mvn clean`
 
-Installation
-------------
+### Installation
 
 Install dependencies:
 
@@ -39,8 +51,7 @@ Run `mvn package` to build, test, and package it into a jar at `target/writelate
 
 Use `java -jar <path_to_jar> <path_to_config_file>` to run the server.
 
-Runtime Configuration
----------------------
+## Runtime Configuration
 
 The configuration file is in `.json` format.