Last active
March 15, 2021 15:46
-
-
Save trautonen/eff9b4066077053282dc to your computer and use it in GitHub Desktop.
New year's Spring Boot tricks in a container
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
$ mvn clean package docker:build |
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
gofurldev: | |
build: . | |
dockerfile: Dockerfile.dev | |
links: | |
- gofurlmongo | |
ports: | |
- "8080:8080" | |
volumes: | |
- .:/gofurl | |
- ~/.m2:/root/.m2 |
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
gofurl: | |
image: gofore/gofurl | |
links: | |
- gofurlmongo | |
ports: | |
- "8080:8080" | |
gofurlmongo: | |
image: mongo:3.1 | |
ports: | |
- "27017:27017" | |
volumes_from: | |
- gofurldata | |
gofurldata: | |
image: debian:wheezy | |
volumes: | |
- /data/db |
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
<plugin> | |
<groupId>com.spotify</groupId> | |
<artifactId>docker-maven-plugin</artifactId> | |
<version>0.3.8</version> | |
<configuration> | |
<imageName>gofore/gofurl</imageName> | |
<dockerDirectory>docker</dockerDirectory> | |
<resources> | |
<resource> | |
<targetPath>/</targetPath> | |
<directory>${project.build.directory}</directory> | |
<include>${project.build.finalName}.jar</include> | |
</resource> | |
</resources> | |
</configuration> | |
</plugin> |
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
$ docker-compose up gofurldev |
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
$ docker-compose up gofurl |
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
FROM java:8 | |
RUN mkdir /opt/maven | |
RUN curl -s -j -k -L "http://www.eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" | tar xz --strip=1 -C "/opt/maven" | |
ENV PATH /opt/maven/bin:$PATH | |
WORKDIR /gofurl | |
CMD ["mvn", "-Dfork=true", "-Drun.jvmArguments=-Dspring.data.mongodb.uri=mongodb://gofurlmongo:27017/gofurl", "spring-boot:run"] |
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
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-devtools</artifactId> | |
<optional>true</optional> | |
</dependency> |
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
<plugin> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-maven-plugin</artifactId> | |
<configuration> | |
<executable>true</executable> | |
</configuration> | |
</plugin> |
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
$ sudo ln -s /var/gofurl/gofurl.jar /etc/init.d/gofurl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment