I have an image that I’ve used for a long time now that works perfectly. It allows me to spin up a new project and via the compose file, I have everything I need to hit the ground running. The one thing I’ve always been frustrated by is that apparent complexity of getting some proxies working for local development.
At the moment I get a web server that will allow me to access the running container via localhost. For my own sanity I’d love to be able to have myproject.test or something along those lines. Is there anyway this can be done via the compose file? I've tried searching for days but I can't seem to find a way to do this but it seems like something that shouldn't be so hard.
My compose file looks like:
version: ‘2’ services: webserver: build: ./docker/webserver image: perch ports: - "80:80" - "443:443" volumes: - ./www:/var/www/html links: - db env_file: - web-variables.env db: image: mysql:5.7 command: mysqld --sql_mode="" ports: - "3306:3306" volumes: - ./db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=xxx - MYSQL_DATABASE=db_xxx
FROM php:7.2-apache RUN apt-get update -y && apt-get install -y \ mcrypt \ imagemagick \ libpng-dev \ libfreetype6-dev \ libjpeg62-turbo-dev \ curl \ libcurl4-openssl-dev \ libxpm-dev \ libvpx-dev \ && docker-php-ext-configure gd \ --with-freetype-dir=/usr/lib/x86_64-linux-gnu/ \ --with-jpeg-dir=/usr/lib/x86_64-linux-gnu/ \ --with-xpm-dir=/usr/lib/x86_64-linux-gnu/ \ --with-vpx-dir=/usr/lib/x86_64-linux-gnu/ \ && docker-php-ext-install \ pdo \ pdo_mysql \ gd \ curl \ && a2enmod \ rewrite \ ssl \ actions \ include \ cgi \ && service apache2 restart