Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit 5937dc6

Browse files
committed
add Dockerfile and supports multistage builds.
1 parent 0776fda commit 5937dc6

File tree

8 files changed

+6661
-204
lines changed

8 files changed

+6661
-204
lines changed

.dockerignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
licenseheader.txt
2+
nb-*.xml
3+
target/
4+
*.log*
5+
*.log.*
6+
.classpath
7+
.project
8+
.settings
9+
logs/*
10+
!.gitkeep
11+
node_modules/
12+
bower_components/
13+
tmp
14+
.DS_Store
15+
.idea
16+
Vagrantfile
17+
dist
18+
.tmp
19+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ tmp
1616
Vagrantfile
1717
dist
1818
.tmp
19+
settings.xml
1920

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:latest AS ui
2+
WORKDIR /usr/src/ui
3+
COPY package.json .
4+
# Setup NPM mirror, optionally for China users.
5+
RUN npm config set registry https://registry.npm.taobao.org/
6+
RUN npm install
7+
COPY . .
8+
RUN node_modules/.bin/bower install --allow-root
9+
RUN node_modules/.bin/gulp
10+
11+
FROM maven:latest AS boot
12+
WORKDIR /usr/src/app
13+
COPY pom.xml .
14+
COPY settings.xml /usr/share/maven/ref/settings-docker.xml
15+
RUN mvn -B -f pom.xml -s /usr/share/maven/ref/settings-docker.xml dependency:resolve
16+
COPY . .
17+
RUN mvn -B -s /usr/share/maven/ref/settings-docker.xml clean package -DskipTests
18+
19+
FROM java:8-jdk-alpine
20+
WORKDIR /static
21+
COPY --from=ui /usr/src/ui/dist/ .
22+
WORKDIR /app
23+
COPY --from=boot /usr/src/app/target/angularjs-springmvc-sample-boot.jar .
24+
ENTRYPOINT ["java", "-jar", "/app/angularjs-springmvc-sample-boot.jar"]
25+
#CMD ["--spring.profiles.active=postgres"]

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,6 @@ You can use one of the following approaches to run this project.
115115

116116
If you want to explore the REST API docs online, there is a *Swagger UI* configured for visualizing the REST APIs, just go to [http://localhost:9000/swagger-ui.html](http://localhost:9000/swagger-ui.html).
117117

118+
### Docker
119+
120+
You can run the project in multistage Docker building development environment, check [Multistage Builds](https://github.com/hantsy/devops-sandbox/blob/master/multistage.md).

0 commit comments

Comments
 (0)