Hi,
ummh... yeah. STILL TESTING and i hope to have a working demo soon.
I'm forced into testing for certificates with xampp
because it is hard-wired that way. That is why when the container
comes up that when you run ps aux it gives errors because it is
hard wired for 443 in apache but i just want 80 right now. Too bad
for me. You have to uncomment a few things to get it to run before building.
Like if you wanted vscode then uncomment vscode section etc.
It is just a thought right now and not ready for use.
To run:
docker build -t myimage43 .
docker run -it -p 41063:80 -v /src:/src -v /src/modules:/src/modules -v
/.libs:/usr/lib/php/20220829 -v /jdk:/jdk --entrypoint /bin/bash myimage43
$ /local/usr/bin> ./my_startup_scripts.sh
ps aux
supervisord process here....
apache xampp processes here....
thanks to chatgpt for the cool code ideas
thanks,
jim
I am including my Dockerfile and supervisord.conf and shell script.
I will go find a free web host, so i can keep posting the code but not in the
forum.
# Use a base image with a standard Linux environment
FROM ubuntu:22.04
# Set environment variables
ENV DEBIAN_FRONTEND noninteractive
# Install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
tmux \
passwd \
sudo \
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 \
build-essential \
zlib1g-dev \
libncurses5-dev \
libx11-dev \
libxext-dev \
libxrender-dev \
libxaw7-dev \
cpio \
autoconf2.13 \
libtool \
automake \
dos2unix \
openjdk-17-jdk \
openjdk-17-jre \
openjdk-17-source \
openjdk-17-doc \
libfontconfig1 \
libx11-6 \
libxext6 \
libxrender1 \
libxtst6 \
libxrandr2 \
libxi6 \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libcups2 \
libgdk-pixbuf2.0-0 \
libgtk-3-0 \
libnss3 \
libxkbcommon-x11-0 \
libglib2.0-0 \
libpango-1.0-0 && \
rm -rf /var/lib/apt/lists/*
COPY build-java.sh /usr/local/bin/build-java.sh
RUN echo "Current Directory: $(pwd)" && ls
RUN chmod +x /usr/local/bin/build-java.sh
# RUN chown supervisor:supervisor /usr/local/bin/build-java.sh
# 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
# 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
# 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 echo supervisor "ALL=(ALL) NOPASSWD: /opt/lampp/xampp start,
/opt/lampp/xampp stop, /opt/lampp/xampp restart" >> /etc/sudoers
# Remove write-protected files with sudo
RUN if [ -f /opt/lampp/logs/httpd.pid ]; then \
rm -f /opt/lampp/logs/httpd.pid; \
fi
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
# 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 /usr/local/bin
EXPOSE 3306
EXPOSE 80
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
# 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-1.10.14-bin.tar.gz -O
/tmp/apache-ant-1.10.14-bin.tar.gz
# RUN mkdir -p /opt/ant && \
# tar -xvzf /tmp/apache-ant-1.10.14-bin.tar.gz -C /opt/ant && \
# export ANT_HOME=/opt/ant && \
# export PATH=$ANT_HOME\bin:$PATH && \
# mv /tmp/apache-ant-1.10.14-bin.tar.gz /opt/ant && \
# ln -s /opt/ant/bin/ant /usr/bin/ant
USER root
WORKDIR ./
# surprise for those that don't do bash you only get 1 CMD per docker file
# Conditional creation of /usr/local/bin if /usr/local exists
RUN if [ ! -d /usr/local ]; then mkdir -p /usr/local; fi
RUN if [ -d /usr/local ]; then mkdir -p /usr/local/bin; fi
RUN chown -R supervisor:supervisor /usr/local/bin/ && \
chmod 755 /usr/local/bin
COPY my-startup-script.sh /usr/local/bin/my-startup-script.sh
RUN chmod +x /usr/local/bin/my-startup-script.sh
RUN chown -R supervisor:supervisor /usr/local/bin/my-startup-script.sh && \
chmod 755 /usr/local/bin/my-startup-script.sh
RUN if [ ! -f /usr/local/bin/my-startup-script.sh ]; then echo "file does not
exist"; fi
RUN [ -f /usr/local/bin/my-startup-script.sh ] && [ -x
/usr/local/bin/my-startup-script.sh ] && /usr/local/bin/my-startup-script.sh ||
echo "Script not found or not executable"
WORKDIR /usr/local/bin
# Create necessary directories and set permissions
RUN mkdir -p /usr/local/bin && \
chmod 755 /usr/local/bin
RUN chown supervisor:supervisor /usr/local/bin/my-startup-script.sh
RUN sed -i 's/\r$//' /usr/local/bin/my-startup-script.sh
# Copy the startup script into the container
# Copy the supervisor configuration file
COPY supervisord.conf /etc/supervisor/supervisord.conf
RUN chown supervisor:supervisor /usr/bin/supervisord
# Set the default command to run supervisord
USER supervisor
---------------------------------------------------------------
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
[inet_http_server] ; inet (TCP) server disabled by default
port-*:9001 ; (ip_address:port specifier, *:port for all iface)
[supervisord]
logfile=/var/log/supervisor/supervisord.log
loglevel=info
pidfile=/var/run/supervisord.pid
nodaemon=false
autorestart=true
user=supervisor
[program:xampp]
command=/usr/local/bin/my-startup-script.sh
directory=/xampp/myproject/app
autostart=true
autorestart=true
startretries=3
user=supervisor
stdout_logfile=/var/log/supervisor/build-java.log
stderr_logfile=/var/log/supervisor/build-java-error.log
----------------------------------------------------------
#!/bin/bash
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
# Start a new tmux session named 'main'
tmux new-session -d -s main
# Change directory to /opt/lampp and start XAMPP
tmux send-keys -t main 'cd /opt/lampp && sudo /opt/lampp/xampp start' C-m
# Attach the tmux session
tmux send-keys -t main 'tmux attach-session -t main' C-m
# while true; do sleep 60; done
Sent with Proton Mail secure email.