Skip to content

Commit

Permalink
FEATURE-58 // Use one Dockerfile instead of two for maven & gradle (#59)
Browse files Browse the repository at this point in the history
* FEATURE-58
1. Add one Dockerfile for both maven & gradle
2. Remove specific files

* Update README

* Remove version from psi-todo for ci build

* Update CI build

1. Remove Dockerfile.mvn & Dockerfile.gradle from ci build
2. Use one Dockerfile

* Update build.yml

use ci environment

Co-authored-by: Raghav2211 <[email protected]>
  • Loading branch information
Raghav2211 and devraghv authored Dec 19, 2020
1 parent 10e3ae5 commit 94751cf
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
run: mvn -B package
- name: Build local image
run: |
docker build -f Dockerfile.mvn --tag psi-todo:1.0.0 .
docker build -f Dockerfile.gradle --tag psi-todo:1.0.0 .
docker build --tag psi-todo .
docker build --build-arg JAR_FILE=build/libs/\*.jar --tag psi-todo .
- name: Build local stack
run: docker-compose --env-file=env/local/Docker.env up -d
run: docker-compose --env-file=env/ci/Docker.env up -d
- name: Test local stack
run: |
sleep 120
Expand Down
11 changes: 11 additions & 0 deletions todo-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM openjdk:11-jre-slim
ARG USER=psi
ARG GROUP=psi
ARG UID=1000
ARG GID=1000
ARG JAR_FILE=target/*.jar
RUN echo $JAR_FILE
RUN groupadd -g ${GID} ${GROUP} && useradd -u ${UID} -g ${GROUP} ${USER}
USER ${USER}:${GROUP}
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-server", "-Dfile.encoding=utf-8", "-XX:+ExitOnOutOfMemoryError", "-Djava.security.egd=file:/dev/./urandom","-Duser.timezone=UTC","-jar","/app.jar"]
4 changes: 0 additions & 4 deletions todo-app/Dockerfile.gradle

This file was deleted.

4 changes: 0 additions & 4 deletions todo-app/Dockerfile.mvn

This file was deleted.

7 changes: 4 additions & 3 deletions todo-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ or
##### Docker image #####

```bash
docker build -f Dockerfile.mvn --tag psi-todo:1.0.0 .

docker build --tag psi-todo:1.0.0 .
```
or
If you use Gradle, you can run it with the following command

```bash
docker build -f Dockerfile.gradle --tag psi-todo:1.0.0 .
docker build --build-arg JAR_FILE=build/libs/\*.jar --tag psi-todo:1.0.0 .
```

## Run ##
Expand Down
2 changes: 1 addition & 1 deletion todo-app/env/ci/Docker.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Set these env variables

#App variables
PSI_TODO_IMAGE=psi-todo:1.0.0
PSI_TODO_IMAGE=psi-todo

#Database variables
MYSQL_IMAGE=mysql:8.0.22
Expand Down

0 comments on commit 94751cf

Please sign in to comment.