Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
80 lines (58 loc) · 2.95 KB
/
Copy pathDockerfile
File metadata and controls
80 lines (58 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Example Dockerfile for containerizing Roller
# STAGE 1 - BUILD ------------------------------------------------
FROM maven:3.9.16-eclipse-temurin-21 AS builder
COPY . /project
WORKDIR /project
RUN mvn -Duser.home=/builder/home -DskipTests=true -B clean install
# STAGE 2 - PACKAGE ------------------------------------------------
FROM tomcat:11.0.29-jdk21-temurin
# Remove existing Tomcat webapps
RUN rm -rf /usr/local/tomcat/webapps/*
# Add Roller configuration to environment
ARG STORAGE_ROOT=/usr/local/tomcat/data
ARG DATABASE_JDBC_DRIVERCLASS=org.postgresql.Driver
ARG DATABASE_JDBC_CONNECTIONURL=jdbc:postgresql://postgresql/rollerdb
ARG DATABASE_JDBC_USERNAME=scott
ARG DATABASE_JDBC_PASSWORD=tiger
ARG DATABASE_HOST=postgresql:5432
ENV STORAGE_ROOT ${STORAGE_ROOT}
ENV DATABASE_JDBC_DRIVERCLASS ${DATABASE_JDBC_DRIVERCLASS}
ENV DATABASE_JDBC_CONNECTIONURL ${DATABASE_JDBC_CONNECTIONURL}
ENV DATABASE_JDBC_USERNAME ${DATABASE_JDBC_USERNAME}
ENV DATABASE_JDBC_PASSWORD ${DATABASE_JDBC_PASSWORD}
ENV DATABASE_HOST ${DATABASE_HOST}
# install Roller WAR as ROOT.war, create data dirs
WORKDIR /usr/local/roller
COPY --from=builder /project/app/target/roller.war /usr/local/tomcat/webapps/ROOT.war
RUN mkdir -p data/mediafiles data/searchindex
# download PostgreSQL and MySQL drivers plus Mail and Activation JARs
WORKDIR /usr/local/tomcat/lib
RUN apt-get update && apt-get install -y wget
RUN wget -O postgresql.jar https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.13/postgresql-42.7.13.jar
RUN wget https://repo1.maven.org/maven2/org/eclipse/angus/angus-mail/2.0.5/angus-mail-2.0.5.jar
RUN wget https://repo1.maven.org/maven2/jakarta/mail/jakarta.mail-api/2.1.5/jakarta.mail-api-2.1.5.jar
RUN wget https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api/2.1.4/jakarta.activation-api-2.1.4.jar
RUN wget https://repo1.maven.org/maven2/org/eclipse/angus/angus-activation/2.0.3/angus-activation-2.0.3.jar
# Add Roller entry-point and go!
COPY docker/entry-point.sh /usr/local/tomcat/bin
COPY docker/wait-for-it.sh /usr/local/tomcat/bin
RUN chgrp -R 0 /usr/local/tomcat
RUN chmod -R g+rw /usr/local/tomcat
WORKDIR /usr/local/tomcat
CMD [ "/usr/local/tomcat/bin/entry-point.sh" ]