docker-cronicle-docker
docker-cronicle-docker copied to clipboard
add this to an already existing container
I'm using docker and I don't see the correct way to implement it programatically... so I wouldn't want to have to add a separate container because I don't know how to connect it to the other container where I already have something running before...
Any way to add this to an already existing container with the following previous configuration:
docker-compose.yml:
version: "3.9"
services:
reverse-proxy:
env_file:
- .env
container_name: Proxy-Server
image: nginxproxy/nginx-proxy
restart: always
depends_on:
- webserver
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./config/ssl:/etc/nginx/certs
extra_hosts:
- "lh-stack.dock:127.0.0.1"
- "pma.lh-stack.dock:127.0.0.1"
ports:
- 80:80
- 443:443
networks:
- lamp-network
environment:
- TRUST_DOWNSTREAM_PROXY=true
- ENABLE_WEBSOCKETS=true
privileged: true
tty: true
webserver:
env_file:
- .env
container_name: LH-STACK-Web-Server
build:
context: ./bin/php81
dockerfile: Dockerfile.secure
args:
VIRTUAL_HOST: lh-stack.dock
restart: always
expose:
- 80
networks:
- lamp-network
volumes:
- ./../project:/var/www/html:rw
- ./../project/public:/var/www/html/public:rw
- ./config/vhost:/etc/apache2/sites-enabled
- ./config/php/php.ini:/usr/local/etc/php/php.ini
- ./config/cron:/etc/cron-task
- ./log/apache2:/var/log/apache2
- ./log/cron:/var/log/cron
environment:
VIRTUAL_HOST: lh-stack.dock
LH_WEB_MASTER: [email protected]
LH_APACHE_DOCUMENT_ROOT: /var/www/html
LH_DOCUMENT_ROOT: /public
extra_hosts:
- "host.docker.internal:host-gateway"
labels:
- "lh2.setup.description=Web Server"
- "lh2.setup.role=webserver"
privileged: true
tty: true
Dockerfile:
FROM php:8.1-apache-bullseye
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get upgrade -y --no-install-recommends --fix-missing
RUN apt-get install -y --no-install-recommends --fix-missing tzdata sed build-essential dialog nano apt-utils cron wget git curl zip openssl gettext-base libnss3-tools
RUN apt-get -y autoremove && \
apt-get clean
RUN a2enmod rewrite
RUN a2enmod ssl
RUN a2enmod headers
RUN a2enmod proxy_wstunnel
RUN service apache2 restart
RUN mkdir -p /var/log/cron && \
chmod 755 /var/log/cron && \
touch /var/log/cron/cron.log
CMD cat /etc/cron-task/new-task >> /etc/cron.d/cron-task && \
chmod 0644 /etc/cron.d/cron-task && \
cron && \
/usr/local/bin/apache2-foreground && \
tail -f /var/log/cron/cron.log
I would like the implementation to be more friendly and viable through environment variables like:
environment:
VIRTUAL_HOST: lh-stack.dock
BASE_APP_URL: lh-stack.dock/cronicle #instead of 3012 use the same like phpmyadmin.