Skip to content

Commit 9562bb7

Browse files
committed
Add Docker support
1 parent bd07962 commit 9562bb7

3 files changed

Lines changed: 96 additions & 4 deletions

File tree

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM php:8.1-apache
2+
3+
RUN apt-get update && apt-get install -y git
4+
5+
RUN pecl install redis && docker-php-ext-enable redis
6+
7+
RUN apt-get install -y libz-dev libmemcached-dev \
8+
&& pecl install memcached && docker-php-ext-enable memcached
9+
10+
RUN docker-php-ext-enable opcache
11+
12+
RUN rm -rf /tmp/pear
13+
14+
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
15+
16+
WORKDIR /var/www
17+
RUN git clone https://github.com/RobiNN1/phpCacheAdmin.git html
18+
19+
RUN chmod 777 /var/www/html
20+
21+
WORKDIR /var/www/html
22+
23+
CMD apache2-foreground

README.md

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,59 @@ Replace all files and delete the `cache` folder.
3131
3232
## Docker
3333

34-
There is no official image yet,
35-
but you can create your own and set ENV variables such as these
36-
`PCA_REDIS_0_HOST=127.0.0.1`, `PCA_REDIS_0_PORT=6379`.
34+
https://hub.docker.com/r/robinn/phpcacheadmin
35+
36+
Run with single command:
37+
38+
```
39+
docker run -p 8080:80 -d --name phpcacheadmin -e "PCA_REDIS_0_HOST=redis_host" -e "PCA_REDIS_0_PORT=6379" -e "PCA_MEMCACHED_0_HOST=memcached_host" -e "PCA_MEMCACHED_0_PORT=11211" robinn/phpcacheadmin
40+
```
41+
42+
Or simply use it in **docker-compose.yml**
43+
44+
```yaml
45+
version: '3'
46+
47+
services:
48+
phpcacheadmin:
49+
image: robinn/phpcacheadmin
50+
ports:
51+
- "8080:80"
52+
environment:
53+
- PCA_REDIS_0_HOST=redis
54+
- PCA_REDIS_0_PORT=6379
55+
- PCA_MEMCACHED_0_HOST=memcached
56+
- PCA_MEMCACHED_0_PORT=11211
57+
links:
58+
- redis
59+
- memcached
60+
redis:
61+
image: redis
62+
memcached:
63+
image: memcached
64+
```
3765
38-
You can change any config option, it just must have `PCA_` prefix.
66+
> **Note**
67+
>
68+
> Is not required to have both Redis and Memcached.
69+
70+
#### Environment variables
71+
72+
Redis:
73+
74+
- `PCA_REDIS_0_NAME` The server name for info panel, useful when you have multiple servers added (Optional, default name is Localhost)
75+
- `PCA_REDIS_0_HOST` Redis server host.
76+
- `PCA_REDIS_0_PORT` Redis server port (Optional, default is 6379)
77+
- `PCA_REDIS_0_DATABASE` Redis database (Optional, default is 0)
78+
- `PCA_REDIS_0_PASSWORD` (Optional, empty by default)
79+
80+
Memcached:
81+
82+
- `PCA_MEMCACHED_0_NAME` The server name for info panel, useful when you have multiple servers added (Optional, default name is Localhost)
83+
- `PCA_MEMCACHED_0_HOST` Memcached server host.
84+
- `PCA_MEMCACHED_0_PORT` Memcached server port (Optional, default is 11211)
85+
86+
To add another server, add the same environment variables, but change 0 to 1 (2 for third server and so on).
3987

4088
## Requirements
4189

docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '3'
2+
3+
services:
4+
phpcacheadmin:
5+
build: .
6+
ports:
7+
- "8080:80"
8+
environment:
9+
- PCA_REDIS_0_NAME=Docker
10+
- PCA_REDIS_0_HOST=redis
11+
- PCA_REDIS_0_PORT=6379
12+
- PCA_MEMCACHED_0_NAME=Docker
13+
- PCA_MEMCACHED_0_HOST=memcached
14+
- PCA_MEMCACHED_0_PORT=11211
15+
links:
16+
- redis
17+
- memcached
18+
redis:
19+
image: redis
20+
memcached:
21+
image: memcached

0 commit comments

Comments
 (0)