Skip to content

Commit

Permalink
docker: switch to apache as web server
Browse files Browse the repository at this point in the history
  • Loading branch information
sonroyaalmerol authored May 15, 2024
1 parent 64cfe59 commit bf984e1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 131 deletions.
27 changes: 15 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ ENV PGID=1000
RUN apt-get update -y && \
apt-get install -y \
ca-certificates \
rsync \
tzdata \
wget \
make \
Expand All @@ -71,7 +70,7 @@ RUN apt-get update -y && \
gnupg2 \
default-mysql-client \
postgresql-client \
nginx \
apache2 \
supervisor \
gnustep-base-runtime \
libc6 \
Expand Down Expand Up @@ -102,29 +101,33 @@ RUN apt-get update -y && \
rm -rf /var/lib/apt/lists/*

# add config, binaries, libraries, and init files
COPY --from=builder /usr/local/sbin/ /usr/sbin/
COPY --from=builder /usr/local/lib/sogo/ /usr/lib/sogo/
COPY --from=builder /usr/lib/GNUstep/ /usr/lib/GNUstep/
COPY --from=builder /usr/local/sbin/ /usr/local/sbin/
COPY --from=builder /usr/local/lib/sogo/ /usr/local/lib/sogo/
COPY --from=builder /usr/local/lib/GNUstep/ /usr/local/lib/GNUstep/
COPY --from=builder /usr/include/GNUstep/ /usr/include/GNUstep/
COPY --from=builder /usr/local/include/GNUstep/ /usr/local/include/GNUstep/
COPY --from=builder /usr/share/GNUstep/ /usr/share/GNUstep/
COPY --from=builder /usr/share/GNUstep/Makefiles/ /usr/share/GNUstep/Makefiles/
COPY --from=builder /etc/GNUstep/ /etc/GNUstep/
COPY --from=builder /tmp/SOGo/Scripts/sogo-default /etc/default/sogo
COPY --from=builder /tmp/SOGo/Scripts/sogo.cron /etc/cron.d/sogo
COPY --from=builder /tmp/SOGo/Scripts/sogo.conf /etc/sogo/sogo.conf
COPY --from=builder /tmp/SOGo/Scripts/ /usr/share/doc/sogo/
COPY --from=builder /tmp/SOGO/Apache/SOGo.conf /etc/apache2/conf-available/SOGo.conf

COPY default-configs/nginx.conf /etc/nginx/sites-enabled/default
COPY supervisord.conf /opt/supervisord.conf
COPY config_parser.sh /opt/config_parser.sh
COPY entrypoint.sh /opt/entrypoint.sh

ADD https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${TARGETARCH} /usr/bin/yq

RUN rsync -avLkq /usr/local/lib/GNUstep/ /usr/lib/GNUstep && \
rsync -avLkq /usr/local/include/GNUstep/ /usr/include/GNUstep && \
rm -rf /usr/local/lib/GNUstep && \
rm -rf /usr/local/include/GNUstep && \
RUN echo "/usr/local/lib/sogo" > /etc/ld.so.conf.d/sogo.conf && \
ldconfig && \
groupadd --system sogo && \
useradd --system --gid sogo sogo && \
mkdir -p /usr/lib/GNUstep/ && \
ln -s /usr/local/lib/GNUstep/SOGo /usr/lib/GNUstep/SOGo && \
ln -s /usr/local/sbin/sogo-tool /usr/sbin/sogo-tool && \
ln -s /usr/local/sbin/sogo-ealarms-notify /usr/sbin/sogo-ealarms-notify && \
ln -s /usr/local/sbin/sogo-slapd-sockd /usr/sbin/sogo-slapd-sockd && \
chmod +rx /usr/bin/yq && \
chmod +rx /opt/entrypoint.sh

Expand Down
107 changes: 0 additions & 107 deletions default-configs/nginx.conf

This file was deleted.

16 changes: 9 additions & 7 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

. /usr/share/GNUstep/Makefiles/GNUstep.sh

set -e

# Check if user "sogo" does not exist
if ! id "sogo" &>/dev/null; then
# Create user "sogo"
useradd -ms /bin/bash sogo
echo "User 'sogo' has been created."
#Solve libssl bug for Mail View
if [[ -z "${LD_PRELOAD}" ]]; then
LIBSSL_LOCATION=$(find / -type f -name "libssl.so.*" -print -quit);echo "LD_PRELOAD=$LIBSSL_LOCATION" >> /etc/default/sogo
echo "LD_LIBRARY_PATH=/usr/local/lib/sogo:/usr/local/lib:$LD_LIBRARY_PATH" >> /etc/default/sogo
export LD_PRELOAD=$LIBSSL_LOCATION
else
echo "LD_PRELOAD=$LD_PRELOAD" >> /etc/default/sogo
echo "LD_LIBRARY_PATH=/usr/local/lib/sogo:/usr/local/lib:$LD_LIBRARY_PATH" >> /etc/default/sogo
export LD_PRELOAD=$LD_PRELOAD
fi

# Set process UID and GID at runtime
Expand Down
10 changes: 5 additions & 5 deletions supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ logfile=/dev/null
logfile_maxbytes=0

[program:sogo]
command=/usr/sbin/sogod -WONoDetach YES -WOLogFile /var/log/sogo/runtime.log -WOPort localhost:20000
command=/bin/bash -c '/usr/sbin/sogod -WONoDetach YES -WOLogFile /var/log/sogo/sogo.log'
user=sogo
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

[program:sogo_logs]
command=/bin/bash -c 'log_file="/var/log/sogo/runtime.log"; while [ ! -f "$log_file" ]; do sleep 0.1; done; tail -f "$log_file"'
command=/bin/bash -c 'log_file="/var/log/sogo/sogo.log"; while [ ! -f "$log_file" ]; do sleep 0.1; done; tail -f "$log_file"'
user=sogo
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

[program:nginx]
command=/usr/sbin/nginx -g "daemon off;"
[program:apache]
command=/usr/sbin/apache2ctl -c "ErrorLog /dev/fd/1" -DFOREGROUND
user=root
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

[program:crond]
command=cron -f -L 15
command=/bin/bash -c 'cron -f -L 15'
autostart=true
user=root
stdout_logfile=/dev/fd/1
Expand Down

0 comments on commit bf984e1

Please sign in to comment.