Skip to content

Commit 1ef1e8a

Browse files
committed
Add Dockerfile
1 parent f433acb commit 1ef1e8a

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM adoptopenjdk/openjdk11:x86_64-alpine-jre-11.0.6_10
2+
3+
# Inspired from https://github.com/docker-library/tomcat/blob/d570ad0cee10e4526bcbb03391b2c0e322b59313/9.0/jdk11/openjdk-slim/Dockerfile
4+
ENV CATALINA_HOME /usr/local/tomcat
5+
ENV PATH $CATALINA_HOME/bin:$PATH
6+
RUN mkdir -p "$CATALINA_HOME"
7+
WORKDIR $CATALINA_HOME
8+
9+
# let "Tomcat Native" live somewhere isolated
10+
ENV TOMCAT_NATIVE_LIBDIR $CATALINA_HOME/native-jni-lib
11+
ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOMCAT_NATIVE_LIBDIR
12+
13+
# see https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/KEYS
14+
# see also "update.sh" (https://github.com/docker-library/tomcat/blob/master/update.sh)
15+
ENV GPG_KEYS 05AB33110949707C93A279E3D3EFE6B686867BA6 07E48665A34DCAFAE522E5E6266191C37C037D42 47309207D818FFD8DCD3F83F1931D684307A10A5 541FBE7D8F78B25E055DDEE13C370389288584E7 61B832AC2F1C5A90F0F9B00A1C506407564C17A3 79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED 9BA44C2621385CB966EBA586F72C284D731FABEE A27677289986DB50844682F8ACB77FC2E86E29AC A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23
16+
17+
ENV TOMCAT_MAJOR 9
18+
ENV TOMCAT_VERSION 9.0.34
19+
ENV TOMCAT_SHA512 9cb32f8807c0e8d2457d52ac032bb496ae7921e1ea0a0c8e6082bf8da60bb57c317a3f2376589962123dd803fdd2816ff960339cb851d9859b2241165fbc278e
20+
21+
22+
# Install Tomcat
23+
RUN wget "https://downloads.apache.org/tomcat/tomcat-9/v9.0.34/bin/apache-tomcat-9.0.34.tar.gz"\
24+
&& mkdir -p /usr/local/tomcat\
25+
&& tar -xf apache-tomcat-9.0.34.tar.gz --strip-components=1\
26+
&& rm bin/*.bat\
27+
&& rm apache-tomcat-9.0.34.tar.gz*\
28+
&& rm -rf webapps\
29+
&& mkdir webapps\
30+
&& find ./bin/ -name '*.sh' -exec sed -ri 's|^#!/bin/sh$|#!/usr/bin/env bash|' '{}' + \
31+
&& chmod -R +rX . \
32+
&& chmod 777 logs temp work
33+
34+
35+
# Copy war file to webapps
36+
COPY target/ROOT.war webapps/ROOT.war
37+
38+
EXPOSE 8080
39+
CMD ["catalina.sh", "run"]

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>com.example</groupId>
77
<artifactId>easy-notes</artifactId>
88
<version>1.0.0</version>
9-
<packaging>jar</packaging>
9+
<packaging>war</packaging>
1010

1111
<name>easy-notes</name>
1212
<description>Rest API for a Simple Note Taking Application</description>
@@ -57,6 +57,7 @@
5757
</dependencies>
5858

5959
<build>
60+
<finalName>ROOT</finalName>
6061
<plugins>
6162
<plugin>
6263
<groupId>org.springframework.boot</groupId>

src/main/java/com/example/easynotes/EasyNotesApplication.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
@SpringBootApplication
88
@EnableJpaAuditing
99
public class EasyNotesApplication {
10-
1110
public static void main(String[] args) {
1211
SpringApplication.run(EasyNotesApplication.class, args);
1312
}

0 commit comments

Comments
 (0)