first commit

This commit is contained in:
oznu
2017-09-02 00:09:42 +10:00
commit 32588ed555
9 changed files with 127 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
config
+61
View File
@@ -0,0 +1,61 @@
FROM tomcat:7-jre8
ENV GUAC_VER=0.9.13-incubating \
GUACAMOLE_HOME=/app/guacamole
ENV PG_MAJOR=9.6 \
PGDATA=/config/postgres \
POSTGRES_USER=guacamole \
POSTGRES_DB=guacamole_db
# Apply the s6-overlay
RUN curl -SLO "https://github.com/just-containers/s6-overlay/releases/download/v1.20.0.0/s6-overlay-amd64.tar.gz" \
&& tar -xzf s6-overlay-amd64.tar.gz -C / --exclude="./bin" --exclude="./sbin" \
&& tar -xzf s6-overlay-amd64.tar.gz -C /usr ./bin \
&& rm -rf s6-overlay-amd64.tar.gz \
&& mkdir -p ${GUACAMOLE_HOME} \
${GUACAMOLE_HOME}/lib \
${GUACAMOLE_HOME}/extensions
WORKDIR ${GUACAMOLE_HOME}
# Install dependencies
RUN apt-get update && apt-get install -y \
libcairo2-dev libjpeg62-turbo-dev libpng-dev \
libossp-uuid-dev libavcodec-dev libavutil-dev \
libswscale-dev libfreerdp-dev libpango1.0-dev \
libssh2-1-dev libtelnet-dev libvncserver-dev \
libpulse-dev libssl-dev libvorbis-dev libwebp-dev \
postgresql-${PG_MAJOR} \
&& rm -rf /var/lib/apt/lists/*
# Install guacamole-server
RUN curl -SLO "https://sourceforge.net/projects/guacamole/files/current/source/guacamole-server-${GUAC_VER}.tar.gz" \
&& tar -xzf guacamole-server-${GUAC_VER}.tar.gz \
&& cd guacamole-server-${GUAC_VER} \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& rm -rf guacamole-server-${GUAC_VER}.tar.gz guacamole-server-${GUAC_VER}
# Install guacamole-client and postgres auth adapter
RUN rm -rf ${CATALINA_HOME}/webapps/ROOT \
&& curl -SLo ${CATALINA_HOME}/webapps/ROOT.war "https://sourceforge.net/projects/guacamole/files/current/binary/guacamole-${GUAC_VER}.war" \
&& curl -SLo ${GUACAMOLE_HOME}/lib/postgresql-42.1.4.jar "https://jdbc.postgresql.org/download/postgresql-42.1.4.jar" \
&& curl -SLO https://sourceforge.net/projects/guacamole/files/current/extensions/guacamole-auth-jdbc-${GUAC_VER}.tar.gz \
&& tar -xzf guacamole-auth-jdbc-${GUAC_VER}.tar.gz \
&& cp -R guacamole-auth-jdbc-${GUAC_VER}/postgresql/guacamole-auth-jdbc-postgresql-0.9.13-incubating.jar ${GUACAMOLE_HOME}/extensions/ \
&& cp -R guacamole-auth-jdbc-${GUAC_VER}/postgresql/schema ${GUACAMOLE_HOME}/ \
&& rm -rf guacamole-auth-jdbc-${GUAC_VER} guacamole-auth-jdbc-${GUAC_VER}.tar.gz
ENV PATH=/usr/lib/postgresql/${PG_MAJOR}/bin:$PATH
ENV GUACAMOLE_HOME=/config/guacamole
WORKDIR /config
RUN ldconfig
COPY root /
ENTRYPOINT [ "/init" ]
+19
View File
@@ -0,0 +1,19 @@
# Docker Guacamole
A Docker Container for [Apache Guacamole](https://guacamole.incubator.apache.org/), a client-less remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH over HTML5.
## Usage
```shell
docker run \
-p 8080:8080 \
-v </path/to/config>:/config \
oznu/guacamole
```
## Parameters
The parameters are split into two halves, separated by a colon, the left hand side representing the host and the right the container side.
* `-p 8080:8080` - Binds the service to port 8080 on the Docker host, **required**
* `-v /config` - The config and database location, **required**
+7
View File
@@ -0,0 +1,7 @@
postgresql-hostname: localhost
postgresql-port: 5432
postgresql-database: guacamole_db
postgresql-username: guacamole
postgresql-password: null
enable-clipboard-integration: true
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv sh
cp -rn /app/guacamole /config
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/with-contenv sh
mkdir -p /config/postgres
chown postgres:postgres /config/postgres
chmod 0700 /config/postgres
if [ -e /config/postgres/postgresql.conf ]; then
echo "Database already configured"
else
s6-setuidgid postgres initdb
fi
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/with-contenv sh
until pg_isready; do
echo "Waiting for postgres to come up..."
sleep 1
done
# Create database if it does not exist
psql -U postgres -lqt | cut -d \| -f 1 | grep -qw $POSTGRES_DB
if [ $? -ne 0 ]; then
createuser -U postgres $POSTGRES_USER
createdb -U postgres -O $POSTGRES_USER $POSTGRES_DB
cat /app/guacamole/schema/*.sql | psql -U $POSTGRES_USER -d $POSTGRES_DB -f -
fi
echo "Starting guacamole client..."
s6-setuidgid root catalina.sh run
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/with-contenv sh
echo "Starting guacamole guacd..."
s6-setuidgid root guacd -f
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/with-contenv sh
echo "Starting postgres..."
s6-setuidgid postgres postgres