This repository has been archived by the owner on Mar 28, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.idea | ||
*.iml | ||
.git | ||
build | ||
cloud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Building the image | ||
FROM gradle:4.1-jdk8-alpine as build | ||
|
||
# Gradle image creates a 'gradle' user, so fallback to 'root' to do initial setup | ||
USER root | ||
|
||
RUN mkdir -p /opt/app | ||
WORKDIR /opt/app | ||
|
||
COPY settings.gradle . | ||
COPY api ./api | ||
|
||
# Assemble artifact | ||
RUN gradle clean build | ||
|
||
|
||
# Run the application in a small container | ||
FROM openjdk:8-jre-alpine as runtime | ||
|
||
RUN mkdir -p /opt/app | ||
|
||
WORKDIR /opt/app | ||
|
||
# Take artifact from previous step | ||
COPY --from=build /opt/app/api/build/libs/api.jar . | ||
|
||
# Create new user to run application on behalf of | ||
RUN addgroup -S -g 1001 app \ | ||
&& adduser -D -S -G app -u 1001 -s /bin/ash app \ | ||
&& chown -R app:app /opt/app | ||
|
||
USER app | ||
|
||
EXPOSE 8080 | ||
|
||
# Run as plain jar file | ||
CMD ["java", "-jar", "api.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM gradle:4.1-jdk8-alpine | ||
|
||
# Gradle image creates a 'gradle' user, so fallback to 'root' to do initial setup | ||
USER root | ||
|
||
ENV GRADLE_USER_HOME /opt | ||
|
||
RUN mkdir -p /opt/app | ||
WORKDIR /opt/app | ||
|
||
# Copy gradle build scripts | ||
COPY .env settings.gradle ./ | ||
COPY api/build.gradle api/dotenv.gradle ./api/ | ||
|
||
# Fetch dependencies - do it before copying the source code to cache the layer | ||
RUN ["gradle", "--no-daemon"] | ||
|
||
COPY api api | ||
|
||
ENTRYPOINT ["gradle", "--no-daemon"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "3" | ||
services: | ||
spring-boot-graphql-template-test: | ||
command: clean test | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.dev | ||
volumes: | ||
- ${PWD}/api:/opt/app/api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: "3" | ||
services: | ||
spring-boot-graphql-template: | ||
command: bootRun | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.dev | ||
volumes: | ||
- ${PWD}/api:/opt/app/api | ||
ports: | ||
- "8080:8080" | ||
- "5005:5005" |