Skip to content

Commit

Permalink
Release 0.9.1 with PHP 8.0 #52
Browse files Browse the repository at this point in the history
Parallel builds for Apache and nginx variants
  • Loading branch information
ckulka committed Jan 15, 2022
1 parent e26cada commit c9ab479
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 4 deletions.
115 changes: 114 additions & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ on:
- published

jobs:
build:
build_apache:
name: Build Apache variant
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -63,6 +64,75 @@ jobs:
ckulka/baikal:apache
ckulka/baikal:latest
build_apache_php80:
name: Build Apache variant (PHP 8.0)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# See https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

# See https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# See https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

# Build Apache httpd images
- name: Build and push Apache httpd variant (experimental)
if: github.event_name == 'push'
uses: docker/build-push-action@v2
with:
file: apache-php8.0.dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
push: true
tags: |
ckulka/baikal:experimental-apache-php8.0
ckulka/baikal:experimental-php8.0
- name: Build and push Apache httpd variant (release)
if: github.event_name == 'release'
uses: docker/build-push-action@v2
with:
file: apache-php8.0.dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
push: true
tags: |
ckulka/baikal:${{ github.ref_name }}-apache-php8.0
ckulka/baikal:${{ github.ref_name }}-php8.0
ckulka/baikal:apache-php8.0
ckulka/baikal:latest-php8.0
build_nginx:
name: Build nginx variant
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# See https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

# See https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# See https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

# Build nginx images
- name: Build and push nginx variant (experimental)
if: github.event_name == 'push'
Expand All @@ -83,3 +153,46 @@ jobs:
tags: |
ckulka/baikal:${{ github.ref_name }}-nginx
ckulka/baikal:nginx
build_nginx_php80:
name: Build nginx variant (PHP 8.0)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# See https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

# See https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# See https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

# Build nginx images
- name: Build and push nginx variant (experimental)
if: github.event_name == 'push'
uses: docker/build-push-action@v2
with:
file: nginx.dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
push: true
tags: ckulka/baikal:experimental-nginx-php8.0

- name: Build and push nginx variant (release)
if: github.event_name == 'release'
uses: docker/build-push-action@v2
with:
file: nginx.dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
push: true
tags: |
ckulka/baikal:${{ github.ref_name }}-nginx-php8.0
ckulka/baikal:nginx-php8.0
35 changes: 35 additions & 0 deletions apache-php8.0.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Multi-stage build, see https://docs.docker.com/develop/develop-images/multistage-build/
FROM alpine AS builder

ENV VERSION 0.9.1

ADD https://github.com/sabre-io/Baikal/releases/download/$VERSION/baikal-$VERSION.zip .
RUN apk add unzip && unzip -q baikal-$VERSION.zip

# Final Docker image
FROM php:8.0-apache

LABEL description="Baikal is a Cal and CardDAV server, based on sabre/dav, that includes an administrative interface for easy management."
LABEL version="0.9.1"
LABEL repository="https://github.com/ckulka/baikal-docker"
LABEL website="http://sabre.io/baikal/"

# Install Baikal and required dependencies
COPY --from=builder baikal /var/www/baikal
RUN chown -R www-data:www-data /var/www/baikal &&\
apt-get update &&\
apt-get install -y libcurl4-openssl-dev sendmail &&\
rm -rf /var/lib/apt/lists/* &&\
docker-php-ext-install curl pdo pdo_mysql

# Configure Apache + HTTPS
COPY files/apache.conf /etc/apache2/sites-enabled/000-default.conf
RUN a2enmod rewrite ssl && openssl req -x509 -newkey rsa:2048 -subj "/C= " -keyout /etc/ssl/private/baikal.private.pem -out /etc/ssl/private/baikal.public.pem -days 3650 -nodes

# Expose HTTPS & data directory
EXPOSE 443
VOLUME /var/www/baikal/config
VOLUME /var/www/baikal/Specific

COPY files/start.sh /opt
CMD [ "sh", "/opt/start.sh" ]
2 changes: 1 addition & 1 deletion examples/docker-compose.custom-storage-location.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker Compose file for a Baikal server

version: '2'
version: "2"
services:
baikal:
image: ckulka/baikal:nginx
Expand Down
2 changes: 1 addition & 1 deletion examples/docker-compose.localvolumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# chown -R 101:101 config Specific <- Use this for Nginx
# chown -R 33:33 config Specific <- Use this for Apache httpd

version: '2'
version: "2"
services:
baikal:
image: ckulka/baikal:nginx
Expand Down
2 changes: 1 addition & 1 deletion examples/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker Compose file for a Baikal server

version: '2'
version: "2"
services:
baikal:
image: ckulka/baikal:nginx
Expand Down
44 changes: 44 additions & 0 deletions nginx-php8.0.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Multi-stage build, see https://docs.docker.com/develop/develop-images/multistage-build/
FROM alpine AS builder

ENV VERSION 0.9.1

ADD https://github.com/sabre-io/Baikal/releases/download/$VERSION/baikal-$VERSION.zip .
RUN apk add unzip && unzip -q baikal-$VERSION.zip

# Final Docker image
FROM nginx:1

LABEL description="Baikal is a Cal and CardDAV server, based on sabre/dav, that includes an administrative interface for easy management."
LABEL version="0.9.1"
LABEL repository="https://github.com/ckulka/baikal-docker"
LABEL website="http://sabre.io/baikal/"

# Install dependencies: PHP (with libffi6 dependency) & SQLite3
RUN curl -o /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg &&\
apt update &&\
apt install -y lsb-release &&\
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list &&\
apt remove -y lsb-release &&\
apt update &&\
apt install -y \
php8.0-curl \
php8.0-fpm \
php8.0-mbstring \
php8.0-mysql \
php8.0-sqlite3 \
php8.0-xml \
sqlite3 \
sendmail &&\
rm -rf /var/lib/apt/lists/* &&\
sed -i 's/www-data/nginx/' /etc/php/8.0/fpm/pool.d/www.conf &&\
sed -i 's/^listen = .*/listen = \/var\/run\/php-fpm.sock/' /etc/php/8.0/fpm/pool.d/www.conf

# Add Baikal & nginx configuration
COPY --from=builder baikal /var/www/baikal
RUN chown -R nginx:nginx /var/www/baikal
COPY files/nginx.conf /etc/nginx/conf.d/default.conf

VOLUME /var/www/baikal/config
VOLUME /var/www/baikal/Specific
CMD /etc/init.d/php8.0-fpm start && chown -R nginx:nginx /var/www/baikal/Specific && nginx -g "daemon off;"

0 comments on commit c9ab479

Please sign in to comment.