|
| 1 | +# Dockerfile |
| 2 | +# |
| 3 | +# OpenGroupware Local Build Image |
| 4 | +# |
| 5 | +# Like OGoDevImage, but builds from local sources (COPY) |
| 6 | +# instead of fetching a tagged release from GitHub. |
| 7 | +# |
| 8 | +# Build from the OGo repo root: |
| 9 | +# docker build -t ogo-local-dev -f docker/OGoLocalBuild.dockerfile . |
| 10 | +# |
| 11 | +FROM ubuntu:noble |
| 12 | + |
| 13 | +LABEL maintainer="Helge Heß <me@helgehess.eu>" |
| 14 | + |
| 15 | +ENV DEBIAN_FRONTEND=noninteractive |
| 16 | + |
| 17 | +# Install the things necessary for OGo, but also a set of debug |
| 18 | +# tooling to work on issues. |
| 19 | +# A real deployment image shouldn't do this once considered stable. |
| 20 | +RUN apt-get -y -qq update \ |
| 21 | + && apt-get -y -qq upgrade \ |
| 22 | + && apt-get -y -qq install \ |
| 23 | + libxml2-dev libldap2 libldap-dev libpq-dev libpq5 \ |
| 24 | + libmemcached-dev libmemcached-tools libcurl4-openssl-dev \ |
| 25 | + libcrypt-dev make libz-dev \ |
| 26 | + gobjc \ |
| 27 | + gnustep-make \ |
| 28 | + gnustep-base-runtime \ |
| 29 | + libgnustep-base-dev \ |
| 30 | + zip \ |
| 31 | + emacs less tree file \ |
| 32 | + sudo gdb linux-tools-generic strace \ |
| 33 | + netcat-openbsd lsof psmisc \ |
| 34 | + git \ |
| 35 | + links curl wget2 \ |
| 36 | + vim \ |
| 37 | + postgresql-client \ |
| 38 | + apache2 \ |
| 39 | + apache2-bin \ |
| 40 | + apache2-data \ |
| 41 | + apache2-utils |
| 42 | + |
| 43 | + |
| 44 | +# Grab the SOPE sources from GitHub (tagged release, cached layer). |
| 45 | +ENV SOPE_VERSION=6.0.6 |
| 46 | +ENV OGO_SOVERSION=5.5 |
| 47 | +ENV OGO_VERSION=${OGO_SOVERSION}.25 |
| 48 | +ENV OGO_ORGANIZATION=https://github.com/OpenGroupware |
| 49 | +ENV SOPE_REPO=${OGO_ORGANIZATION}/SOPE |
| 50 | + |
| 51 | +RUN mkdir /src |
| 52 | +ADD ${SOPE_REPO}/archive/refs/tags/${SOPE_VERSION}.tar.gz \ |
| 53 | + /src/SOPE.tar.gz |
| 54 | +WORKDIR /src |
| 55 | +RUN tar zxf SOPE.tar.gz && rm SOPE.tar.gz |
| 56 | + |
| 57 | + |
| 58 | +# Compile and install SOPE |
| 59 | +WORKDIR /src/SOPE-${SOPE_VERSION} |
| 60 | +RUN ./configure \ |
| 61 | + --with-gnustep \ |
| 62 | + --enable-xml \ |
| 63 | + --enable-postgresql \ |
| 64 | + --enable-openldap \ |
| 65 | + --with-ssl=ssl \ |
| 66 | + --enable-debug \ |
| 67 | + --disable-strip \ |
| 68 | + && make -j 8 \ |
| 69 | + && make install |
| 70 | + |
| 71 | + |
| 72 | +# Copy local OGo sources into the image |
| 73 | +COPY . /src/OGo |
| 74 | + |
| 75 | +# Backward-compat symlink so startup scripts that reference |
| 76 | +# /src/OpenGroupware.org-<version>/... keep working. |
| 77 | +RUN ln -s /src/OGo \ |
| 78 | + /src/OpenGroupware.org-${OGO_VERSION} |
| 79 | + |
| 80 | +# Compile and install OGo |
| 81 | +WORKDIR /src/OGo |
| 82 | +RUN ./configure \ |
| 83 | + --with-gnustep \ |
| 84 | + --gsmake=/usr/share/GNUstep/Makefiles \ |
| 85 | + --enable-debug \ |
| 86 | + --disable-strip \ |
| 87 | + && make -j 8 \ |
| 88 | + && make install |
| 89 | + |
| 90 | +# Add some necessary links |
| 91 | +RUN mkdir /usr/local/share/opengroupware.org-${OGO_SOVERSION}/ \ |
| 92 | + && ln -s /src/OGo/Themes/WebServerResources \ |
| 93 | + /usr/local/share/opengroupware.org-${OGO_SOVERSION}/www \ |
| 94 | + && ln -s /src/OGo/WebUI/Templates \ |
| 95 | + /usr/local/share/opengroupware.org-${OGO_SOVERSION}/templates \ |
| 96 | + && ln -s /src/OGo/WebUI/Resources \ |
| 97 | + /usr/local/share/opengroupware.org-${OGO_SOVERSION}/translations |
| 98 | + |
| 99 | + |
| 100 | +# Enable the necessary Apache modules |
| 101 | +RUN a2enmod proxy \ |
| 102 | + && a2enmod proxy_http \ |
| 103 | + && a2enmod proxy_balancer \ |
| 104 | + && a2enmod lbmethod_byrequests \ |
| 105 | + && a2enmod headers |
| 106 | + |
| 107 | + |
| 108 | +# Add OGo User |
| 109 | +USER root |
| 110 | +RUN useradd -u 700 --create-home --shell /bin/bash OGo |
| 111 | + |
| 112 | +USER OGo |
| 113 | + |
| 114 | +RUN mkdir -p /home/OGo/GNUstep/Defaults |
| 115 | +COPY docker/OGo-globaldomain.plist \ |
| 116 | + /home/OGo/GNUstep/Defaults/NSGlobalDomain.plist |
| 117 | +COPY docker/OGo-webui.plist \ |
| 118 | + /home/OGo/GNUstep/Defaults/ogo-webui-5.5.plist |
| 119 | + |
| 120 | + |
| 121 | +# Add a user for development purposes. |
| 122 | +# 501 is the macOS UID of the default user, gives us proper |
| 123 | +# permissions |
| 124 | +USER root |
| 125 | +RUN useradd -u 501 --create-home --shell /bin/bash developer \ |
| 126 | + && adduser developer sudo \ |
| 127 | + && adduser developer root \ |
| 128 | + && usermod -aG sudo developer |
| 129 | + |
| 130 | +USER developer |
| 131 | +RUN mkdir -p /home/developer/GNUstep/Defaults |
| 132 | +COPY docker/Dev-globaldomain.plist \ |
| 133 | + /home/developer/GNUstep/Defaults/NSGlobalDomain.plist |
| 134 | +COPY docker/Dev-webui.plist \ |
| 135 | + /home/developer/GNUstep/Defaults/ogo-webui-5.5.plist |
| 136 | + |
| 137 | +USER root |
| 138 | +COPY docker/startup-opengroupware /usr/local/bin/ |
| 139 | +COPY docker/startup-opengroupware-stack /usr/local/bin/ |
| 140 | +RUN mkdir /var/run/opengroupware \ |
| 141 | + && chown OGo /var/run/opengroupware \ |
| 142 | + && mkdir /var/log/opengroupware \ |
| 143 | + && chown OGo /var/log/opengroupware |
| 144 | + |
| 145 | +# this should be set on the outside to a globally unique value |
| 146 | +ENV OGO_INSTANCE_ID=OGo |
| 147 | + |
| 148 | +ENV OGO_DATABASE_NAME=OGo |
| 149 | +ENV OGO_DATABASE_USER=OGo |
| 150 | +ENV OGO_DATABASE_PASSWORD=OGo |
| 151 | +ENV OGO_DATABASE_HOST=postgres |
| 152 | +ENV OGO_DATABASE_PORT=5432 |
| 153 | + |
| 154 | +# How many OGo Instances should be booted up. |
| 155 | +ENV OGO_INSTANCE_COUNT=10 |
| 156 | +# Apache VServer Name, used for redirects! |
| 157 | +ENV OGO_SERVER_NAME=localhost |
| 158 | +ENV OGO_SERVER_PORT=443 |
| 159 | +ENV OGO_SERVER_PROTOCOL=https |
| 160 | +ENV OGO_SERVER_ADMIN=webmaster@${OGO_SERVER_NAME} |
| 161 | + |
| 162 | + |
| 163 | +# Default Startup |
| 164 | +# Let's run Apache on 80, the default port |
| 165 | +EXPOSE 80 |
| 166 | + |
| 167 | +USER root |
| 168 | +WORKDIR /tmp |
| 169 | + |
| 170 | +# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop |
| 171 | +STOPSIGNAL SIGWINCH |
| 172 | + |
| 173 | +CMD [ "startup-opengroupware-stack" ] |
0 commit comments