File tree 5 files changed +117
-0
lines changed
5 files changed +117
-0
lines changed Original file line number Diff line number Diff line change
1
+ *
2
+ ! gradle
3
+ ! src
4
+ ! build.gradle
5
+ ! gradlew
6
+ ! gradlew.bat
7
+ ! lombok.config
8
+ ! settings.gradle
Original file line number Diff line number Diff line change
1
+ name : Create and publish Docker image
2
+
3
+ on :
4
+ release :
5
+ types : [published]
6
+
7
+ env :
8
+ REGISTRY : ghcr.io
9
+ IMAGE_NAME : ${{ github.repository }}
10
+
11
+ jobs :
12
+ build-and-push-image :
13
+ runs-on : ubuntu-latest
14
+ permissions :
15
+ contents : read
16
+ packages : write
17
+
18
+ steps :
19
+ - name : Checkout repository
20
+ uses : actions:checkout@v2
21
+
22
+ - name : Set up Docker Buildx
23
+ uses : docker/setup-buildx-action@v1
24
+
25
+ - name : Log in to the Container registry
26
+ uses : docker/login-action@v1
27
+ with :
28
+ registry : ${{ env.REGISTRY }}
29
+ username : ${{ github.actor }}
30
+ password : ${{ secrets.GITHUB_TOKEN }}
31
+
32
+ - name : Extract metadata (tags, labels) for Docker
33
+ id : meta
34
+ uses : docker/metadata-action@v3
35
+ with :
36
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37
+ - name : Build and push
38
+ uses : docker/build-push-action@v2
39
+ with :
40
+ context : .
41
+ push : true
42
+ tags : ${{ steps.meta.outputs.tags }}
43
+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
1
+ FROM openjdk:12-ea-jdk-alpine AS build
2
+
3
+ RUN apk add --no-cache wget unzip
4
+
5
+ WORKDIR /opt
6
+
7
+ RUN wget -O gradle.zip "https://services.gradle.org/distributions/gradle-5.2-all.zip" \
8
+ && unzip -d ./gradle ./gradle.zip \
9
+ && rm ./gradle.zip
10
+ ENV PATH=$PATH:/opt/gradle/gradle-5.2/bin
11
+
12
+ WORKDIR /lexidb
13
+
14
+ COPY src /lexidb/src/
15
+ COPY gradle /lexidb/gradle/
16
+ COPY build.gradle /lexidb/
17
+ COPY gradlew /lexidb/
18
+ COPY gradlew.bat /lexidb/
19
+ COPY lombok.config /lexidb/
20
+ COPY settings.gradle /lexidb/
21
+
22
+ RUN gradle build
23
+
24
+
25
+
26
+ FROM openjdk:16-alpine
27
+
28
+ RUN addgroup --system java_user && adduser -S -s /bin/false -G java_user java_user
29
+ RUN mkdir /lexidb \
30
+ && chown -R java_user:java_user /lexidb
31
+
32
+ COPY --from=build --chown=java_user:java_user /lexidb/build/libs/lexidb-2.0.jar /lexidb/
33
+ COPY --from=build --chown=java_user:java_user /lexidb/src/main/resources/app.properties /lexidb/
34
+
35
+ WORKDIR /lexidb
36
+
37
+ EXPOSE 1189
38
+ USER java_user
39
+
40
+ ENTRYPOINT ["java" , "-jar" , "lexidb-2.0.jar" ]
41
+ CMD ["./app.properties" ]
42
+
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ DOCKER_BUILDKIT=1 docker build --progress=plain -f Dockerfile -t lexidb:0.0.1 .
Original file line number Diff line number Diff line change @@ -13,6 +13,14 @@ Build using the following command in the project directroy;
13
13
$ gradle build
14
14
```
15
15
16
+ ## Running on Docker
17
+
18
+ There is a docker instance of LexiDB which can be ran using the following command:
19
+
20
+ ``` bash
21
+ docker run -it -p 127.0.0.1:3000:1189 --rm ucrel/lexidb:0.0.1
22
+ ```
23
+
16
24
## Deploy
17
25
18
26
Deploy locally;
@@ -21,6 +29,19 @@ Deploy locally;
21
29
$ java -jar build/libs/lexidb-2.0.jar /path/to/app.properties
22
30
```
23
31
32
+ ```
33
+ docker run -it -p 127.0.0.1:3000:1189 --rm lexidb:0.0.1
34
+ ```
35
+
36
+ ```
37
+ docker run -it -p 127.0.0.1:3000:1189 --init --entrypoint "java" --rm lexidb:0.0.1 -Xmx8g -jar lexidb-2.0.jar ./app.properties
38
+ ```
39
+
40
+ ```
41
+ docker run -it -p 127.0.0.1:3000:1189 --init --entrypoint "java" --memory=8g --memory-swap=8g --rm lexidb:0.0.1 -Xmx8g -jar lexidb-2.0.jar ./app.properties
42
+ ```
43
+
44
+
24
45
## Test
25
46
26
47
You can test whether the server is running by making a simple API call in your browser; [ http://localhost:1189/api/test ] ( http://localhost:1189/api/test )
You can’t perform that action at this time.
0 commit comments