Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
asolopovas committed Feb 5, 2024
1 parent cbe84c4 commit 7b1ac85
Showing 1 changed file with 44 additions and 21 deletions.
65 changes: 44 additions & 21 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,78 @@

# Dockerfile for PHP with wkhtmltopdf
# Dockerfile for PHP with wkhtmltopdf for Laravel and WordPress Development

This Dockerfile creates a Docker image based on `php:8.3.2-fpm-alpine3.19` with `wkhtmltopdf` installed, along with various PHP extensions and tools necessary for development and production environments.
This Dockerfile creates a Docker image based on `php:8.3.2-fpm-alpine3.19` with `wkhtmltopdf` installed, along with various PHP extensions and tools necessary for development and production environments, catering specifically to Laravel and WordPress development.

## Prerequisites

- Docker installed on your machine. Visit [Docker's official website](https://docs.docker.com/get-docker/) for installation instructions.
- Basic knowledge of Docker and containerization.
- Git for version control.

## How to Download

To download the Dockerfile, you can clone this repository using the command below:
To download the Dockerfile, clone this repository using the command below:

```
git clone https://github.com/asolopovas/php-fpm.git
```

## Build Instructions
## Installed Libraries and Extensions

Navigate to the directory containing the Dockerfile and run the following command to build the Docker image:
The Docker image includes the following PHP extensions:

```
docker build -t php-wkhtmltopdf .
- bcmath
- calendar
- exif
- gd (with support for freetype, jpeg, and webp)
- mbstring
- pdo
- pdo_mysql
- pdo_pgsql
- pdo_sqlite
- mysqli
- pcntl
- xml
- zip
```

This will create an image named `php-wkhtmltopdf` containing PHP 8.3.2 with wkhtmltopdf and necessary extensions.
### PECL Extensions:

## Using Docker Hub
- **Imagick:** For image manipulation.
- **Xdebug:** For debugging and development.
- **Swoole:** For asynchronous programming and coroutines.
- **Redis:** For caching and session storage.
- **Igbinary:** For more efficient serialization.

The Docker image is also available on Docker Hub. You can pull a specific tag of the image using the following command:
Additionally, the image is equipped with `wkhtmltopdf` for HTML to PDF conversion, various development tools like Git, ImageMagick, and utilities for image optimization and development workflows.

```
docker pull asolopovas/php-fpm:[tag]
```
## Build Instructions

Replace `[tag]` with the actual tag you wish to pull. You can find the list of available tags on the Docker Hub page: [asolopovas/php-fpm](https://hub.docker.com/repository/docker/asolopovas/php-fpm/general).
Navigate to the directory containing the Dockerfile and execute the following command to build the Docker image:

## Configuration
```
docker build -t asolopovas/php-fpm .
```

The Dockerfile includes the installation of wkhtmltopdf from `surnet/alpine-wkhtmltopdf:3.18.0-0.12.6-small` and installs various PHP extensions and tools like GD, Imagick, Redis, Xdebug, and more. Additionally, it configures the environment to support web development tasks efficiently.
This will create an image named `php-wkhtmltopdf` containing PHP 8.3.2 with wkhtmltopdf and the necessary extensions.

## Usage
## Using Docker Hub

Once the image is built or pulled from Docker Hub, you can run a container using the following command:
The Docker image is also available on Docker Hub. To pull a specific tag of the image, use the command:

```
docker run -d --name php-container php-wkhtmltopdf
docker pull asolopovas/php-fpm:[tag]
```

This command starts a container named `php-container` based on the `php-wkhtmltopdf` image. You can then use Docker commands to interact with your container, execute PHP scripts, or configure it further to suit your development needs.
Replace `[tag]` with the actual tag you wish to pull. Available tags can be found on the Docker Hub page: [asolopovas/php-fpm](https://hub.docker.com/repository/docker/asolopovas/php-fpm/general).

## Makefile Automation

The included Makefile automates the process of building the Docker image, tagging the build, and pushing it to both GitHub and Docker Hub based on the version specified in a `Version` text file. Commands:

## Customization
- **Build Image:** `make build` - Builds the Docker image based on the version specified in the `Version` file.
- **Tag and Push to GitHub:** `make tag-push` - Tags the current commit in Git with the version from the `Version` file and pushes these tags to GitHub.
- **Push Image to Docker Hub:** `make docker-push` - Pushes the built Docker image to Docker Hub under the tag specified in the `Version` file.

You can customize the Dockerfile to include more PHP extensions, configure PHP settings, or include additional services based on your project requirements.
Ensure you have the necessary permissions for pushing to the repositories and that you're logged in to Docker Hub (`docker login`) before using the Makefile commands.

0 comments on commit 7b1ac85

Please sign in to comment.