I’m trying to deploy Kirby on a server using Docker. It works well in my local Docker environment, but on the Ubuntu server, I get an error saying that the panel cannot be found or installed. Below are my Dockerfile and compose files.
Docker-compose.yml
version: "3"
services:
webserver:
build:
context: ./kirbyserver
dockerfile: Dockerfile
container_name: kirby_server
environment:
USERID: '1001'
# image: docker-starterkit
# expose:
# - "80"
ports:
- "8000:80"
volumes:
- ./kirbyserver/backend:/var/www/html:rw
env_file:
- ./kirbyserver/id.env
Dockerfile
# Use latest official Ubuntu image
FROM ubuntu:latest
# Set timezone
ENV TZ=Europe/Berlin
# Set geographic area using above variable
# This is necessary, otherwise building the image doesn't work
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Remove annoying messages during package installation
ARG DEBIAN_FRONTEND=noninteractive
# Install packages: web server & PHP plus extensions
RUN apt-get update && apt-get install -y \
apache2 \
apache2-utils \
ca-certificates \
php \
libapache2-mod-php \
php-curl \
php-dom \
php-gd \
php-intl \
php-json \
php-mbstring \
php-xml \
php-zip \
git && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Clone the Kirby starter kit repository into the /app directory
RUN git clone --depth 1 https://github.com/getkirby/starterkit.git /app
# Copy virtual host configuration from current path onto existing 000-default.conf
COPY default.conf /etc/apache2/sites-available/000-default.conf
# Set up necessary directories and permissions
RUN mkdir -p /app/site/accounts /app/site/sessions && \
chown -R www-data:www-data /app && \
chmod -R 755 /app
# Remove default content (existing index.html)
RUN rm -rf /var/www/html && ln -s /app /var/www/html
# Activate Apache modules headers & rewrite
RUN a2enmod headers rewrite
# Change web server's user id to match local user, replace with your local user id
RUN usermod --uid 1001 www-data
# Tell container to listen to port 80 at runtime
EXPOSE 80
# Start Apache web server
CMD [ "/usr/sbin/apache2ctl", "-DFOREGROUND" ]
and this is my config.php
return [
'api' => [
'basicAuth' => true,
'allowInsecure' => true, // localhost without https
],
'debug' => true,
'kql' => [
'auth' => true
],
'panel' =>[
'install' => true
]
];