Skip to content

Commit

Permalink
Add Ubuntu 24.04 image
Browse files Browse the repository at this point in the history
  • Loading branch information
hbenali committed Apr 15, 2024
1 parent e40f0a9 commit 68766bc
Show file tree
Hide file tree
Showing 5 changed files with 312 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ jobs:
context: 22.04
- imageTag: 22.04
context: 22.04
# Ubuntu 24
- imageTag: 24
context: 24.04
- imageTag: 24.04
context: 24.04
### Latest
- imageTag: latest
context: 22.04
context: 24.04

uses: exoplatform/swf-scripts/.github/workflows/buildDockerImage.yml@master
with:
Expand Down
101 changes: 101 additions & 0 deletions 24.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Dockerizing a base images with:
#
# - Ubuntu 24.04
#
# Build: docker build -t exoplatform/ubuntu .
#
# Run: docker run -ti exoplatform/ubuntu

FROM ubuntu:24.04
LABEL maintainer="eXo Platform <docker@exoplatform.com>"

ENV TINI_VERSION v0.19.0
ENV TINI_GPG_KEY 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7
ENV GOSU_VERSION 1.14
ENV GOSU_GPG_KEY B42F6819007F00F88E364FD4036A9C25BF357DD4

ENV TERM=xterm \
DEBIAN_FRONTEND=noninteractive

WORKDIR /tmp

# Install base packages
# --force-confold: do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix. With this option alone, even configuration
# files that you have not modified are left untouched. You need to combine it with
# --force-confdef to let dpkg overwrite configuration files that you have not modified.
ENV _APT_OPTIONS -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
RUN apt-get -qq update \
&& apt-get -qq -y install ${_APT_OPTIONS} lsb-release \
&& apt-get -qq update \
&& apt-get -qq -y upgrade ${_APT_OPTIONS} \
&& apt-get -qq -y install ${_APT_OPTIONS} \
wget \
curl \
netcat-traditional \
unzip \
gpg \
gnupg2 \
apt-transport-https \
locales \
expect \
htop \
&& locale-gen en_US.UTF-8 \
&& apt-get -qq -y autoremove \
&& apt-get -qq -y clean \
&& rm -rf /var/lib/apt/lists/*

ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8

# GPG settings
RUN mkdir ~/.gnupg && chmod 700 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf

# Installing Tini
RUN set -ex \
&& ( \
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys ${TINI_GPG_KEY} \
|| gpg2 --keyserver keyserver.ubuntu.com --recv-keys ${TINI_GPG_KEY} \
)

RUN set -ex \
&& wget -nv -O /usr/local/bin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini \
&& wget -nv -O /usr/local/bin/tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc \
&& gpg --verify /usr/local/bin/tini.asc \
&& chmod +x /usr/local/bin/tini

# Installing Gosu
RUN set -ex \
&& ( \
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys ${GOSU_GPG_KEY} \
|| gpg2 --keyserver keyserver.ubuntu.com --recv-keys ${GOSU_GPG_KEY} \
)

RUN set -ex \
&& curl -sS -o /usr/local/bin/gosu -L "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& curl -sS -o /usr/local/bin/gosu.asc -L "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu

# Installing wait-for-it.sh utility
COPY bin/wait-for-it.sh /usr/local/bin/
RUN chown root:root /usr/local/bin/wait-for-it.sh \
&& chmod +x /usr/local/bin/wait-for-it.sh \
&& ln -s /usr/local/bin/wait-for-it.sh /usr/local/bin/wait-for.sh \
&& ln -s /usr/local/bin/wait-for-it.sh /usr/local/bin/wait-for

# Create needed directories
ENV DOWNLOAD_DIR /srv/downloads
RUN mkdir -p "${DOWNLOAD_DIR}" && chmod -R 777 "${DOWNLOAD_DIR}"

# Add some aliases
RUN echo "alias ll='ls -al --color'" > /etc/profile.d/aliases.sh \
echo "alias rm='rm -i'" >> /etc/profile.d/aliases.sh

# Configure htop for root user
COPY conf/htoprc.conf /root/.config/htop/htoprc
RUN chown root:root /root/.config/htop/htoprc

ENTRYPOINT ["/usr/local/bin/tini", "--"]
CMD [ "bash" ]
179 changes: 179 additions & 0 deletions 24.04/bin/wait-for-it.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
#!/usr/bin/env bash
#
# Use this script to test if a given TCP host/port are available
#
# source : https://github.com/vishnubob/wait-for-it

cmdname=$(basename $0)

echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }

usage()
{
cat << USAGE >&2
Usage:
$cmdname host:port [-s] [-t timeout] [-- command args]
-h HOST | --host=HOST Host or IP under test
-p PORT | --port=PORT TCP port under test
Alternatively, you specify the host and port as host:port
-s | --strict Only execute subcommand if the test succeeds
-q | --quiet Don't output any status messages
-t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout
-- COMMAND ARGS Execute command with args after the test finishes
USAGE
exit 1
}

wait_for()
{
if [[ $TIMEOUT -gt 0 ]]; then
echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT"
else
echoerr "$cmdname: waiting for $HOST:$PORT without a timeout"
fi
start_ts=$(date +%s)
while :
do
if [[ $ISBUSY -eq 1 ]]; then
nc -z $HOST $PORT
result=$?
else
(echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1
result=$?
fi
if [[ $result -eq 0 ]]; then
end_ts=$(date +%s)
echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds"
break
fi
sleep 1
done
return $result
}

wait_for_wrapper()
{
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
if [[ $QUIET -eq 1 ]]; then
timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
else
timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
fi
PID=$!
trap "kill -INT -$PID" INT
wait $PID
RESULT=$?
if [[ $RESULT -ne 0 ]]; then
echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT"
fi
return $RESULT
}

# process arguments
while [[ $# -gt 0 ]]
do
case "$1" in
*:* )
hostport=(${1//:/ })
HOST=${hostport[0]}
PORT=${hostport[1]}
shift 1
;;
--child)
CHILD=1
shift 1
;;
-q | --quiet)
QUIET=1
shift 1
;;
-s | --strict)
STRICT=1
shift 1
;;
-h)
HOST="$2"
if [[ $HOST == "" ]]; then break; fi
shift 2
;;
--host=*)
HOST="${1#*=}"
shift 1
;;
-p)
PORT="$2"
if [[ $PORT == "" ]]; then break; fi
shift 2
;;
--port=*)
PORT="${1#*=}"
shift 1
;;
-t)
TIMEOUT="$2"
if [[ $TIMEOUT == "" ]]; then break; fi
shift 2
;;
--timeout=*)
TIMEOUT="${1#*=}"
shift 1
;;
--)
shift
CLI=("$@")
break
;;
--help)
usage
;;
*)
echoerr "Unknown argument: $1"
usage
;;
esac
done

if [[ "$HOST" == "" || "$PORT" == "" ]]; then
echoerr "Error: you need to provide a host and port to test."
usage
fi

TIMEOUT=${TIMEOUT:-15}
STRICT=${STRICT:-0}
CHILD=${CHILD:-0}
QUIET=${QUIET:-0}

# check to see if timeout is from busybox?
TIMEOUT_PATH=$(realpath $(which timeout))
if [[ $TIMEOUT_PATH =~ "busybox" ]]; then
ISBUSY=1
BUSYTIMEFLAG="-t"
else
ISBUSY=0
BUSYTIMEFLAG=""
fi

if [[ $CHILD -gt 0 ]]; then
wait_for
RESULT=$?
exit $RESULT
else
if [[ $TIMEOUT -gt 0 ]]; then
wait_for_wrapper
RESULT=$?
else
wait_for
RESULT=$?
fi
fi

if [[ $CLI != "" ]]; then
if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then
echoerr "$cmdname: strict mode, refusing to execute subprocess"
exit $RESULT
fi
exec "${CLI[@]}"
else
exit $RESULT
fi
24 changes: 24 additions & 0 deletions 24.04/conf/htoprc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=1
shadow_other_users=0
show_thread_names=0
highlight_base_name=1
highlight_megabytes=1
highlight_threads=0
tree_view=1
header_margin=1
detailed_cpu_time=0
cpu_count_from_zero=0
update_process_names=0
color_scheme=0
delay=15
left_meters=LeftCPUs Memory Swap
left_meter_modes=1 1 1
right_meters=RightCPUs Tasks LoadAverage Uptime
right_meter_modes=1 2 2 2
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Supported tags and respective `Dockerfile` links

| Ubuntu edition | Docker tags | Dockerfile |
| ---------------------- | ----------------------- | ------------------------------------------ |
| Ubuntu Jammy Jellyfish | `22.04`, `20`, `latest` | [( 22.04/Dockerfile )](./22.04/Dockerfile) |
| Ubuntu Noble Numbat | `24.04`, `24`, `latest` | [( 24.04/Dockerfile )](./22.04/Dockerfile) |
| Ubuntu Jammy Jellyfish | `22.04`, `22` | [( 22.04/Dockerfile )](./22.04/Dockerfile) |
| Ubuntu Focal Fossa | `20.04`, `20` | [( 20.04/Dockerfile )](./20.04/Dockerfile) |
| Ubuntu Bionic Beaver | `18.04`, `18` | [( 18.04/Dockerfile )](./18.04/Dockerfile) |
| Ubuntu Xenial Xerus | `16.04`, `16` | [( 16.04/Dockerfile )](./16.04/Dockerfile) |
Expand Down

0 comments on commit 68766bc

Please sign in to comment.