-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9323f07
Showing
9 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
IMAP_HOST=mail.example.com | ||
SMTP_HOST=mail.example.com | ||
IMAP_SSL=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.DS_Store | ||
docker-compose.override.yml | ||
.env | ||
.env.* | ||
!.env.example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM caddy:2.8.4-alpine AS caddy | ||
|
||
FROM php:8.3-fpm-alpine | ||
|
||
RUN apk update && apk add supervisor | ||
|
||
COPY --from=caddy /usr/bin/caddy /usr/bin/caddy | ||
|
||
# Configure supervisor | ||
RUN mkdir -p /etc/supervisor.d/ | ||
COPY ./docker/supervisord.ini /etc/supervisor.d/supervisord.ini | ||
|
||
# Configure Caddy web server | ||
COPY ./docker/Caddyfile /etc/caddy/Caddyfile | ||
|
||
# Configure PHP-FPM | ||
RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini | ||
|
||
WORKDIR /src | ||
COPY ./src /var/www/html | ||
|
||
EXPOSE 80 | ||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor.d/supervisord.ini"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Autodiscover | ||
|
||
IMAP/SMTP autodiscover for email clients. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
services: | ||
autodiscover: | ||
build: . | ||
ports: | ||
- "8000:80" | ||
env_file: | ||
- .env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:80 { | ||
root * /var/www/html | ||
php_fastcgi localhost:9000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:caddy] | ||
command=/usr/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:php-fpm] | ||
command=php-fpm | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
header('Content-Type: application/xml'); | ||
$raw = file_get_contents('php://input'); | ||
$imap_server = getenv('IMAP_HOST'); | ||
$imap_ssl = getenv('IMAP_SSL'); | ||
$smtp_server = getenv('SMTP_HOST'); | ||
|
||
$matches = array(); | ||
preg_match('/<EMailAddress>(.*)<\/EMailAddress>/', $raw, $matches); | ||
?> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006"> | ||
<Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a"> | ||
<Account> | ||
<AccountType>email</AccountType> | ||
<Action>settings</Action> | ||
<Protocol> | ||
<Type>IMAP</Type> | ||
<Server><?= $imap_server ?></Server> | ||
<Port>993</Port> | ||
<DomainRequired>off</DomainRequired><?= (empty($matches)) ? "\n" : PHP_EOL . "<LoginName>" . $matches[1] . "</LoginName>" ?> | ||
<SPA>on</SPA> | ||
<SSL><?= $imap_ssl == true ? "on" : "off" ?></SSL> | ||
<AuthRequired>on</AuthRequired> | ||
</Protocol> | ||
<Protocol> | ||
<Type>SMTP</Type> | ||
<Server><?= $smtp_server ?></Server> | ||
<Port>587</Port> | ||
<DomainRequired>off</DomainRequired><?= (empty($matches)) ? "\n" : PHP_EOL . "<LoginName>" . $matches[1] . "</LoginName>" ?> | ||
<SPA>off</SPA> | ||
<Encryption>off</Encryption> | ||
<AuthRequired>on</AuthRequired> | ||
<UsePOPAuth>off</UsePOPAuth> | ||
<SMTPLast>off</SMTPLast> | ||
</Protocol> | ||
</Account> | ||
</Response> | ||
</Autodiscover> |