afterlogic / webmail-lite-8

Open-source webmail script for existing IMAP server

Home Page:https://afterlogic.org/webmail-lite-8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker

mickael-kerjean opened this issue · comments

Hey guys, awesome work that you did!
As I couldn't find a docker image for the app, or more instructions on installing on kubernetes, I've works this out and just wanted to share it all instead of keeping everyting for myself:

Dockerfile:

FROM debian:9
MAINTAINER Mickael Kerjean <mickael@kerjean.me>

# ref:
# - https://afterlogic.com/docs/webmail-lite-8/installation/installing-from-repository

RUN apt-get update -y && \
    ####################################
    ## Install
    apt-get install -y curl git unzip apache2 libapache2-mod-php php-mysql php-curl php-sabre-dav && \
    curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
    apt-get install -y nodejs && \
    cd /var/www/ && \
    curl -LO https://github.com/afterlogic/webmail-lite-8/archive/latest.zip && \
    unzip latest.zip && \
    mv webmail-lite-8-latest webmail && \
    rm latest.zip && \
    cd webmail && \
    curl -LO https://getcomposer.org/download/1.10.7/composer.phar && \
    php composer.phar install && \
    php composer.phar run pre-config && \
    npm install && \
    npm install --global gulp-cli && \
    gulp styles --themes Default && \
    gulp js:min && \
    chown -R www-data:www-data /var/www/webmail/data && \
    ####################################
    ## Configuration
    sed -i 's|DocumentRoot.*|DocumentRoot /var/www/webmail|' /etc/apache2/sites-enabled/000-default.conf && \
    ####################################
    ## Cleanup    
    rm -rf /var/lib/apt/lists/*

EXPOSE 80
WORKDIR "/var/www/webmail"
VOLUME ["/var/www/webmail/data/settings/", "/var/www/webmail/data/logs/"]
ADD run.sh /run.sh
ENTRYPOINT ["/run.sh"]

run.sh:

#!/bin/bash
set -e

source /etc/apache2/envvars
apache2 -DFOREGROUND

A prebuilt images is available from here

I also made a deployment on kubernetes which looks like this:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: me-kerjean-mail
  name: me-kerjean-mail
  namespace: selfhosted
spec:
  replicas: 1
  selector:
    matchLabels:
      app: me-kerjean-mail
  template:
    metadata:
      labels:
        app: me-kerjean-mail
    spec:
      containers:
      - image: machines/webmail-lite
        name: me-kerjean-mail
        volumeMounts:
        - mountPath: /var/www/webmail/data/settings/
          name: me-kerjean-mail-volume
      volumes:
      - name: me-kerjean-mail-volume
        hostPath:
          path: /mnt/me-kerjean-mail
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: me-kerjean-mail
  name: me-kerjean-mail
  namespace: selfhosted
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: me-kerjean-mail
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: me-kerjean-mail
  namespace: selfhosted
  annotations:
    kubernetes.io/ingress.class: "nginx"
    cert-manager.io/cluster-issuer: "ssl-letsencrypt-prod"
    ingress.kubernetes.io/ssl-redirect: "true"
    acme.cert-manager.io/http01-edit-in-place: "true"
spec:
  tls:
  - hosts:
    - mail.kerjean.me
    secretName: me-kerjean-mail
  rules:
  - host: mail.kerjean.me
    http:
      paths:
      - backend:
          serviceName: me-kerjean-mail
          servicePort: 80

I'm closing as there's no problem :)