Skip to content

Instantly share code, notes, and snippets.

@dydemin
Created January 3, 2024 04:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dydemin/261546e5f279b1a04e952466bf79d566 to your computer and use it in GitHub Desktop.
Save dydemin/261546e5f279b1a04e952466bf79d566 to your computer and use it in GitHub Desktop.
Docker: Ubuntu 22.04 + Apache2 + PHP8.2 + kalkancrypt.so
FROM ubuntu:22.04
# Install all required soft
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install tzdata \
&& ln -fs /usr/share/zoneinfo/Asia/Almaty /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata \
&& apt-get -y install \
apache2 \
lsb-release \
gnupg2 \
ca-certificates \
apt-transport-https \
software-properties-common \
libpcsclite1 \
libltdl7 \
&& add-apt-repository ppa:ondrej/php \
&& apt-get update \
&& apt-get -y install php8.2 \
php8.2-common \
php8.2-mbstring \
php8.2-mysql \
php8.2-zip \
php8.2-gd \
php8.2-curl \
&& a2enmod rewrite
# Copy and enable kalkancrypt PHP extension
COPY kalkancrypt.so /usr/lib/php/20220829/kalkancrypt.so
RUN echo -e "; configuration for php kalkancrypt module\n; priority=99\nextension=kalkancrypt.so" > /etc/php/8.2/mods-available/kalkancrypt.ini
RUN phpenmod kalkancrypt
# Add test php file for web-server
RUN echo "<?php\n\nif (extension_loaded('kalkancrypt')) {\n echo 'kalkancrypt extension loaded.<br>';\n if (KalkanCrypt_Init() > 0) {\n echo 'failed to initialize kalkancrypt.';\n } else {\n echo 'kalkancrypt initialized successfully.';\n }\n} else {\n echo 'kalkancrypt extension does not loaded.';\n}\n" > /var/www/html/index.php
# Run apache2
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment