Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add this to an already existing container #243

Open
arcanisgk opened this issue Oct 16, 2023 · 0 comments
Open

add this to an already existing container #243

arcanisgk opened this issue Oct 16, 2023 · 0 comments

Comments

@arcanisgk
Copy link

I'm using docker and I don't see the correct way to merge two images... 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: icarosnet@gmail.com
      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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant