Hi-
Im releasing the last sample version of a docker file to put some tools
in place to work with Royale. I am just a beginner at docker.
I have to do work on Ant and improving the docker file.
But here is the final version of the mockup.
I probably cant post every time i improve it.
The AI really helps with docker.
I don't know how hard it will be to switch from maven to ant to build the
projects.
I liked moonshine for windows the best but the extension I want to use wont run
in windows too easily.
I hope these posts gave some cool ideas for someone.
Down the road when I get a site running I will post on my own site.
please see code below:
# Use Debian as base image
FROM debian:bookworm-slim
# Set environment variables
ENV DEBIAN_FRONTEND noninteractive
# Install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
git \
ca-certificates \
unzip \
net-tools \
supervisor \
nano \
php-dev \
autoconf \
automake \
libtool \
vim \
gcc \
make \
less \
curl \
php-json \
php-xml \
php-mbstring \
software-properties-common \
apt-transport-https \
gpg \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
# Define the environment variable for Apache Royale
ENV ROYALE_VERSION=0.9.10
ENV ROYALE_HOME=/opt/apache-royale
# Set environment variables for the XAMPP version
ENV XAMPP_VERSION=8.2.12
ENV XAMPP_TAR_FILE=xampp-linux-x64-8.2.12-0-installer.run
ENV
XAMPP_DOWNLOAD_URL=https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/8.2.12/xampp-linux-x64-8.2.12-0-installer.run/download
# Download the XAMPP installer
RUN wget ${XAMPP_DOWNLOAD_URL} -O /tmp/xampp-installer.run && \
chmod +x /tmp/xampp-installer.run && \
/tmp/xampp-installer.run --mode text && \
rm /tmp/xampp-installer.run
# apache-royale-0.9.10-src.tar.gz
# Download and install Apache Royale
RUN mkdir -p ${ROYALE_HOME} && \
wget
https://downloads.apache.org/royale/${ROYALE_VERSION}/apache-royale-${ROYALE_VERSION}-src.tar.gz
-O /tmp/royale.tar.gz && \
tar -xvzf /tmp/royale.tar.gz -C ${ROYALE_HOME} && \
rm /tmp/royale.tar.gz
# Clone the OpenJDK repository
RUN git clone --branch jdk-22+36 --single-branch --depth 1
https://github.com/openjdk/jdk.git
WORKDIR /jdk
# Set the environment variable for Apache Royale commands
ENV PATH="${ROYALE_HOME}/apache-royale-${ROYALE_VERSION}/bin:${PATH}"
# Copy a custom Apache configuration file if you have one
# COPY my_apache_config.conf /etc/apache2/sites-available/000-default.conf
# Create necessary directories
RUN mkdir -p /src /src/modules /usr/lib/php/20220829
# Set the working directory
WORKDIR /src
RUN mkdir -p /src/jdk-22.0.1
# COPY /jdk-22.0.1 /src/jdk-22.0.1
# Set the working directory
# ./jdk-22.0.1
# Copy PHP extension source code into the Docker image
COPY . .
# Run phpize and build the PHP extension
RUN phpize \
&& ./configure --prefix=/usr/lib/php/20220829 && make && make install
# Set up Supervisor (assuming you have a supervisord.conf)
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c",
"/etc/supervisor/conf.d/supervisord.conf"]
# Create non-root user and group for Supervisor
RUN groupadd -r supervisor && useradd -r -g supervisor supervisor
RUN mkdir -p /.libs \
&& chown -R supervisor:supervisor /.libs \
&& chmod -R 777 /.libs
WORKDIR /var/run
# Ensure supervisor.sock exists and set permissions
RUN test -f /var/run/supervisor.sock || (rm -f /var/run/supervisor.sock &&
touch /var/run/supervisor.sock && chown supervisor:supervisor
/var/run/supervisor.sock && chmod 666 /var/run/supervisor.sock)
RUN unlink /var/run/supervisor.sock
# Set permissions for /var/run directory
RUN chmod 777 /var/run
# Switch to non-root user
USER root
# Set log permissions only if supervisord.log exists
RUN chown -R supervisor:supervisor /var/log \
&& chmod 777 /var/log
RUN test -f /var/log/supervisord.log && chmod 666 /var/log/supervisord.log || :
# Set working directory for XAMPP (assuming this is where your application runs)
WORKDIR /xampp
# Define volumes and expose ports
VOLUME /src /src/modules /usr/lib/php/20220829 /.libs /jdk
EXPOSE 3306
EXPOSE 80
EXPOSE 443
CMD ["bash", "-c", "service mysql start && apachectl -D FOREGROUND"]
# Set the working directory
WORKDIR ${ROYALE_HOME}/apache-royale-${ROYALE_VERSION}
# Default command to execute Apache Royale commands (you can change this
according to your needs)
CMD ["bash"]...
# Set environment variables for XAMPP
ENV PATH="/opt/lampp/bin:${PATH}"
# Example to add custom PHP configuration
# COPY php.ini /opt/lampp/etc/php.ini
COPY my-startup-script.sh /usr/local/bin/my-startup-script.sh
RUN chmod +x /usr/local/bin/my-startup-script.sh
# surprise for those that don't do bash you only get 1 CMD per docker file
CMD ["/usr/local/bin/my-startup-script.sh"]
# in the my-startup-script.sh
# e.g. commands
# /opt/lamp/lamp -c start
# Add the Visual Studio Code repository
RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor
> /usr/share/keyrings/microsoft-archive-keyring.gpg \
&& wget -qO-
https://packages.microsoft.com/repos/vscode/dist/stable/main/binary-amd64/Packages
| tee /etc/apt/sources.list.d/vscode.list
# Download and install Visual Studio Code
RUN curl -L "https://go.microsoft.com/fwlink/?LinkID=760868" -o code_amd64.deb \
&& apt-get update \
&& apt-get install -y ./code_amd64.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f code_amd64.deb
# Download Apache Ant and extract it
RUN wget
https://downloads.apache.org/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz \
&& unzip apache-ant-${ANT_VERSION}-bin.zip \
&& mv apache-ant-${ANT_VERSION} /opt/ant \
&& ln -s /opt/ant/bin/ant /usr/bin/ant \
&& rm apache-ant-${ANT_VERSION}-bin.zip
RUN mkdir -p /opt/ant && \
tar -xvzf /tmp/apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ant && \
RUN ANT_HOME=/opt/ant \
export PATH=$ANT_HOME\bin:$PATH
WORKDIR /opt/ant/bin
# Verify the installation
# RUN ant -version DONT NEED TO RUN VERSION UNLESS YOU WANT TO FOOL WITH ENV
WITH POWERSHELL TO SET TEMP VARS
# below is how to run the funny system
#docker build -t my-xampp-image .
#docker run -d -p 80:80 -p 443:443 -p 3306:3306 --name my-xampp-container
my-xampp-image
THANKS
later,
jim
Sent with Proton Mail secure email.