From dcec36cdf77df50d77187115c36da97c7dab9d17 Mon Sep 17 00:00:00 2001 From: erickmob Date: Sat, 11 Jul 2020 15:43:15 -0300 Subject: [PATCH] dockerized project --- .dockerignore | 2 ++ .gitignore | 5 ++++- Dockerfile | 26 ++++++++++++++++++++++++++ docker-compose.yml | 14 ++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..38c0346 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.mvn +files/ diff --git a/.gitignore b/.gitignore index 4065e56..947e76b 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,7 @@ build/ #IDE metadata -**.idea/** \ No newline at end of file +**.idea/** + +#DS_Store metadata +**.DS_Store** \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..66e3391 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM maven:3.6.3-adoptopenjdk-11 as build + +WORKDIR /usr/src/scheduling-job/ +COPY . /usr/src/scheduling-job/ + +RUN mvn clean package + +FROM adoptopenjdk/openjdk11:alpine-jre + +RUN addgroup -S spring && adduser -S spring -G spring + +RUN mkdir -p /files && \ + chown -R spring:spring /files + +USER spring:spring + + +VOLUME /files + +WORKDIR /app + +COPY --from=build /usr/src/scheduling-job/target/scheduling-job-0.0.1-SNAPSHOT.jar /app/app.jar + +EXPOSE 8080 + +ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6156170 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '2.2' +services: + web: + build: + context: ./ + dockerfile: Dockerfile + image: web + ports: + - 8080:8080 + networks: + - app + +networks: + app: