Skip to content

Commit c6d1a29

Browse files
committed
🐳 Dockerize!
for easier setup, testing, and rapid deployment could be improved by having mvn dependencies pre-downloaded before CMD and only downloading when mvn dependencies change since last docker image cache
1 parent b1d949c commit c6d1a29

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM anapsix/alpine-java:8_jdk_unlimited
2+
3+
WORKDIR /home/app
4+
5+
# install dumb-init; helps dockerized java handle signals properly
6+
# using ADD avoids installing openssl dependency
7+
ADD https://github.com/Yelp/dumb-init/releases/download/v1.1.3/dumb-init_1.1.3_amd64 /usr/bin/dumb-init
8+
RUN chmod +x /usr/bin/dumb-init
9+
ENTRYPOINT ["dumb-init", "--"]
10+
11+
# process will run as non-root `app` user
12+
RUN addgroup app \
13+
&& adduser -s /bin/bash -D app -G app \
14+
&& chown -R app:app .
15+
16+
# install maven
17+
RUN wget http://mirrors.ocf.berkeley.edu/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz \
18+
&& tar zxvf apache-maven-3.3.9-bin.tar.gz \
19+
&& rm -f apache-maven-3.3.9-bin.tar.gz
20+
21+
COPY . ./
22+
23+
USER app
24+
25+
EXPOSE 8080
26+
27+
# start with spring boot
28+
CMD apache-maven-3.3.9/bin/mvn spring-boot:run -DgitlabUrl="$GITLAB_URL"

0 commit comments

Comments
 (0)