69 lines
No EOL
2.4 KiB
Docker
69 lines
No EOL
2.4 KiB
Docker
# Start from base image (built on Docker host)
|
|
FROM git.kakio.us/kakious/coder-base:latest
|
|
|
|
# Install everything as root
|
|
USER root
|
|
|
|
RUN DEBIAN_FRONTEND="noninteractive" apt-get update
|
|
|
|
# Create the persistent data folder
|
|
RUN mkdir -p /data
|
|
|
|
# Install MySQL
|
|
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server
|
|
|
|
# Move the data folder to the persistent data folder and grant mysql access to it
|
|
RUN mv /var/lib/mysql /data/mysql
|
|
RUN echo "datadir = /data/mysql" >> /etc/mysql/mysql.conf.d/mysqld.cnf
|
|
RUN usermod -a -G coder mysql
|
|
|
|
# Create a symbolic link to the persistent data folder just in case
|
|
RUN ln -s /data/mysql /var/lib/mysql
|
|
|
|
# Install Redis
|
|
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y redis-server
|
|
|
|
# Install the latest redisjson
|
|
RUN wget https://redismodules.s3.amazonaws.com/rejson/rejson.Linux-ubuntu20.04-x86_64.2.4.5.zip
|
|
RUN unzip rejson.Linux-ubuntu20.04-x86_64.2.4.5.zip
|
|
RUN mkdir -p /usr/lib/redis/modules
|
|
RUN cp rejson.so /usr/lib/redis/modules/rejson.so
|
|
RUN rm rejson.Linux-ubuntu20.04-x86_64.2.4.5.zip && rm rejson.so
|
|
|
|
# Update the redis config to include loadmodule
|
|
RUN echo "loadmodule /usr/lib/redis/modules/rejson.so" >> /etc/redis/redis.conf
|
|
|
|
# Install the latest rabbitmq
|
|
RUN apt install -y rabbitmq-server
|
|
RUN ln -s /data/rabbitmq /var/lib/rabbitmq
|
|
|
|
RUN sudo usermod -d /data/mysql/ mysql
|
|
|
|
|
|
RUN DEBIAN_FRONTEND="noninteractive" add-apt-repository ppa:ondrej/php -y
|
|
RUN DEBIAN_FRONTEND="noninteractive" apt-get update
|
|
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y php8.2 php8.2-cli php8.2-bz2 php8.2-curl php8.2-mbstring php8.2-intl php8.2-apcu php8.2-redis php8.2-fpm
|
|
|
|
# Install Composer
|
|
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
|
|
|
|
#Configure PHP-FPM
|
|
RUN sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/8.2/fpm/php.ini
|
|
RUN sed -i 's/;apc.enable_cli=0/apc.enable_cli=1/g' /etc/php/8.2/fpm/php.ini
|
|
|
|
# Install NGINX
|
|
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y nginx
|
|
|
|
# Setup Nginx config
|
|
RUN rm /etc/nginx/sites-enabled/default
|
|
|
|
#Download nginx config from git
|
|
RUN wget https://raw.githubusercontent.com/kakious/coder/main/nginx.conf -O /etc/nginx/sites-enabled/default
|
|
|
|
|
|
# Make sure the services are started on the start of the container
|
|
CMD service mysql start && service redis-server start && service rabbitmq-server start && service php8.2-fpm start && service nginx start
|
|
|
|
# Set back to coder user
|
|
USER coder |