-
Notifications
You must be signed in to change notification settings - Fork 2
Deploying to Jacob Docker
- Have the following plugin in
pom.xml
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.11</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
- Have the following in
src/main/docker/Dockerfile
FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD reachrabbit-0.9.0.jar app.jar
RUN sh -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
- Set tons of parameters in
application-production.properties
correctly.
- Have Docker installed locally
- Have Docker Cloud account
- Signin using
docker login
command. So you can pull images from Docker cloud.
To deploy to jacob
, you will need to:
-
Build a docker image using
production
configuration.`SPRING_PROFILES_ACTIVE=production mvn package docker:build``
This creates a docker image name reachrabbit/reachrabbit
-
Tag it, (think of tag as commit)
docker tag reachrabbit/reachrabbit ssabpisa/reachrabbit:tagname
-
Push image to docker cloud
docker push ssabpisa/reachrabbit:tagname
Note the thing behind the colon (:tagname) can be anything as long as you are consistent. For example, a tag that makes sense maybe "RC1-October"
-
SSH to reachrabbit.com (
ws-jacob-twilight
) or by direct IP54.254.142.108
-
Pull the image
sudo docker pull ssabpisa/reachrabbit:tagname
-
Run it
sudo docker run -d -p 8080:8080 ssabpisa/reachrabbit:tagname
The -p parameter says that expose port 8080 on the inside as 8080 on the outside. The -d parameter says that detach immediate and run in background.
For debugging purpose you can omit the -d option, and see the trace.
- Check that it's running
sudo docker ps