Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile to set up the environment needed to run a GWC release #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Use an official Ruby 2.x image as a base
FROM ruby:2.7

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV EDITOR=vim

# Install dependencies and tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
wget \
unzip \
openjdk-11-jdk \
python3-pip \
dos2unix \
vim \
&& rm -rf /var/lib/apt/lists/*

# Install Maven 3.9.9
RUN wget https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.zip -O /tmp/maven.zip && \
unzip /tmp/maven.zip -d /opt && \
ln -s /opt/apache-maven-3.9.9 /opt/maven && \
ln -s /opt/maven/bin/mvn /usr/bin/mvn && \
rm /tmp/maven.zip

# Set Maven environment variables
ENV MAVEN_HOME=/opt/maven
ENV PATH=$MAVEN_HOME/bin:$PATH

# Prepare settings.xml file
COPY settings.xml /root/.m2/settings.xml

# Install the latest Sphinx
RUN pip3 install --upgrade pip && \
pip3 install --upgrade sphinx

# Install XSDDoc (assuming the latest version is 0.11) and fix line endings
RUN wget https://sourceforge.net/projects/xframe/files/xsddoc/xsddoc-1.0/xsddoc-1.0.zip/download -O /tmp/xsddoc.zip && \
unzip /tmp/xsddoc.zip -d /opt && \
dos2unix /opt/xsddoc-1.0/bin/xsddoc && \
chmod +x /opt/xsddoc-1.0/bin/xsddoc && \
rm /tmp/xsddoc.zip

# Patch XSDDoc to run on Java 11
RUN curl "https://repo1.maven.org/maven2/xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar" -o /opt/xsddoc-1.0/lib/xercesImpl.jar

# Set Java environment variables
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
ENV PATH=$JAVA_HOME/bin:/opt/xsddoc-1.0/bin:$PATH

# Clone the GeoWebCache repositories
RUN git clone https://github.com/GeoWebCache/gwc-release.git /root/gwc-release
RUN git clone https://github.com/GeoWebCache/geowebcache.git /root/geowebcache
RUN cp /root/gwc-release/release.rb /root/geowebcache

# Make sure the release.rb dependencies are installed
RUN gem install bundler -v 2.4.22
RUN cd /root/gwc-release && bundle install

# Copy the git setup script into the container
COPY setup_git.sh /usr/local/bin/setup_git.sh

# Make the script executable
RUN chmod +x /usr/local/bin/setup_git.sh

# Set the script as the entrypoint
ENTRYPOINT ["/usr/local/bin/setup_git.sh"]

# Get in the home directory when the shell is executed
WORKDIR /root

# By default, run a bash shell
CMD ["/bin/bash"]

12 changes: 12 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>nexus</id>
<username>yourNameHere</username>
<password>yourPasswordHere</password>
</server>
</servers>
</settings>
14 changes: 14 additions & 0 deletions setup_git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# Exit on error
set -e

# Configure Git username and email if provided
if [ -n "$GIT_USERNAME" ]; then
git config --global user.name "$GIT_USERNAME"
fi

if [ -n "$GIT_EMAIL" ]; then
git config --global user.email "$GIT_EMAIL"
fi

exec /bin/bash