ยง2024-09-08
- [SeksunNiampan Signal-Server Dockerfile](https://github.com/SeksunNiampan/docker-Signal-Server/blob/master/signalserver/Dockerfile_
# Use Ubuntu 24.04 as the base image
FROM ubuntu:24.04
# Set environment variables to avoid interaction during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install required packages
RUN apt-get update && \
apt-get install -y \
openjdk-21-jdk \
maven \
git \
wget \
&& apt-get clean
# Clone the Signal-Server repository
RUN git clone https://github.com/signalapp/Signal-Server.git /opt/Signal-Server
# Set the working directory to the cloned repository
WORKDIR /opt/Signal-Server
# Compile the project using Maven
RUN mvn clean install -DskipTests
# Add a sample config.yml file (adjust path and content as needed)
COPY config.yml /opt/Signal-Server/config/config.yml
# Expose the necessary port (adjust as needed)
EXPOSE 8080
# Command to run the application (adjust as needed)
CMD ["mvn", "exec:java", "-Dexec.mainClass=com.signal.SignalServer"]
#
# Notes
#
# docker build --tag signal-server:ubuntu_focal (--no-cache) ./
# sudo docker run -it signal-server:ubuntu_focal /bin/bash
# sudo docker run -d -p 42100:8000 --mount type=bind,source=/volume1/JupyterHub,target=/home/alexlai/JupyterHub --name jupyterhub signal-server:ubuntu_focal jupyterhub
# outside-port:inside-port
# docker ps
# docker stop (NAMES)
# docker rm (NAMES)
# docker image prune -a # remove dangling image
#
- sample config.yml
# Sample config.yml
server:
port: 8080
logging:
level: INFO
# FROM holbertonschool/base-ubuntu-1404
FROM ubuntu:14.04
LABEL maintainer="57160608@go.buu.ac.th"
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get update
RUN apt-get install wget -y
# --> Install java 1.8 <--
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:openjdk-r/ppa
RUN apt-get -y upgrade
RUN apt-get -y update
RUN apt-get install openjdk-8-jdk openjdk-8-jre -y
RUN echo "JAVA_HOME=\"/usr/lib/jvm/java-8-openjdk-amd64\"" >> /etc/environment
RUN ["/bin/bash", "-c", "source /etc/environment"]
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc
RUN echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> ~/.bashrc
RUN ["/bin/bash", "-c", "source ~/.bashrc"]
RUN update-ca-certificates -f
RUN apt-get install --reinstall ca-certificates-java
# --> Install maven 3.5 <--
RUN apt-get install maven -y
RUN cd /usr/local && wget http://www-eu.apache.org/dist/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
RUN cd /usr/local && tar xzf apache-maven-3.5.2-bin.tar.gz \
&& ln -s apache-maven-3.5.2 apache-maven
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> /etc/profile.d/apache-maven.sh
RUN echo "export M2_HOME=/usr/local/apache-maven" >> /etc/profile.d/apache-maven.sh
RUN echo "export MAVEN_HOME=/usr/local/apache-maven" >> /etc/profile.d/apache-maven.sh
RUN echo "export PATH=\${M2_HOME}/bin:\${PATH}" >> /etc/profile.d/apache-maven.sh
RUN source /etc/profile.d/apache-maven.sh && mvn -version
RUN java -version
COPY ./ssl /ssl
# --> Install Signal Server <--
COPY ./Signal-Server /Signal-Server
RUN source /etc/profile.d/apache-maven.sh && cd /Signal-Server && mvn install -DskipTests
# --> Run server <--
EXPOSE 8080
EXPOSE 8081
CMD ["/bin/bash", "-c", "java -jar /Signal-Server/target/TextSecureServer-1.70.jar server /Signal-Server/config/Signal.yml"]