https://github.com/tomkyle/docker-php80-boilerplate
https://github.com/tomkyle/docker-php80-boilerplate
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tomkyle/docker-php80-boilerplate
- Owner: tomkyle
- Created: 2021-10-31T12:38:57.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-25T08:59:39.000Z (over 4 years ago)
- Last Synced: 2025-08-20T02:49:16.767Z (11 months ago)
- Language: Dockerfile
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dockerfile boilerplate
**Following the article** [How to setup an Apache, PHP, and HTTPS development environment with Docker](https://dockerwebdev.com/tutorials/docker-php-development/)
## Installation
Clone repo and dive into project directory:
```bash
$ gh repo clone tomkyle/docker-php80-boilerplate docker-php80
$ cd docker-php80
```
Install [**mkcert**](https://github.com/FiloSottile/mkcert), a simple tool for making locally-trusted development certificates.
```bash
$ brew install mkcert
```
## Make certificates
Make sure to keep the cert file names as seen here as they are copied to the Docker image and then referenced in `000-default.conf`
```bash
$ mkcert \
-key-file localhost-php80-key.pem \
-cert-file localhost-php80.pem \
localhost 127.0.0.1 ::1
```
## Build docker image
Use this section to build a Docker image. The image is also available on https://hub.docker.com/repository/docker/tomkyle/php74
```bash
$ docker image build -t tomkyle/php80 .
```
Assuming you don’t have errors, a new Docker image will be built. Run `docker image ls` to see `php80` in the list of images.
```bash
$ docker image ls
```
## Example usage in a project
Copy [docker-compose.yml](./docker-compose.yml) to your app project and adapt to your needs
```yaml
version: '3'
services:
app:
# Change as you need
container_name: app
# The image from above Dockerfile
image: tomkyle/php80
# Assume "htdocs" being the public folder
# which itself is a sub-directory of the project root
volumes:
- ./:/var/www
- ./htdocs/:/var/www/html
ports:
- "8080:80"
- "443:443"
```
Go to project dir and start Docker machine:
```bash
$ cd ~/path/tp/app
$ docker compose up
```
Shutdown:
```bash
$ docker compose down
```
Your project can now be reached via
- **HTTPS: [https://localhost](https://localhost)**
- **HTTP-only: [http://localhost:8080](http://localhost:8080)**