ยง2024-09-09

# This is to build a specific Rocket.Chat version
# Use Ubuntu 22.04(Jmmy)as the base image, failed to npm install
# Use Ubuntu 20.04(Focal Fossa)
FROM ubuntu:20.04

# Set the timezone to a specific region and install required packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y \
    apt-utils \
    tzdata \
    curl build-essential graphicsmagick \
    unzip \
    && apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Set the timezone (adjust as needed)
RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
    dpkg-reconfigure --frontend noninteractive tzdata

# install a specifc version of NodeJs 14.21.3 and npm 6.14.18 will be installed
# Rocket.Chat up to 6.12.0 requires the above version
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs

#
WORKDIR /opt

# RUN curl to get new release codes
RUN curl -L https://releases.rocket.chat/6.12.0/download -o Rocket.Chat.6.12.0.tgz

# unapack this will take a while
RUN tar xvf Rocket.Chat.6.12.0.tgz

# cd dir and run npom install
WORKDIR  /opt/bundle/programs/server/
RUN npm install

# 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 -f  Dockerfile.Rocket.Chat --tag rocket.chat:ubuntu_focal (--no-cache) ./
# sudo docker run -it rocket.chat: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
#

# This is to build a specific Rocket.Chat version
# Use Ubuntu 22.04(Jmmy)as the base image, failed to npm install
# Use Ubuntu 20.04(Focal Fossa) OK
# Use Debian 12 (bookworm), nodeJS version v18.19.0 and no npm 
# Use Debian 11 (Bullseye) nodeJS v14.21.3, npm 6.14.18
FROM debian:11

# Set the timezone to a specific region and install required packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y \
    apt-utils \
    tzdata \
    curl build-essential graphicsmagick \
    unzip \
    && apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Set the timezone (adjust as needed)
RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
    dpkg-reconfigure --frontend noninteractive tzdata

# install a specifc version of NodeJs 14.21.3 and npm 6.14.18 will be installed
# Rocket.Chat up to 6.12.0 requires the above version
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs

#
WORKDIR /opt

# RUN curl to get new release codes
RUN curl -L https://releases.rocket.chat/6.12.0/download -o Rocket.Chat.6.12.0.tgz

# unapack this will take a while
RUN tar xvf Rocket.Chat.6.12.0.tgz

# cd dir and run npom install
WORKDIR  /opt/bundle/programs/server/
RUN npm install

# 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 -f  Dockerfile.Rocket.Chat.Debian --tag rocket.chat:debian_bulleye (--no-cache) ./
# sudo docker run -it rocket.chat:debian_bulleye /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
#