Skip to content

Commit 6ea6463

Browse files
committed
update docker commands
1 parent 08ebd32 commit 6ea6463

File tree

2 files changed

+35
-24
lines changed

2 files changed

+35
-24
lines changed

Makefile

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,60 @@ TAG=${git describe --tags}
44

55
## -- Container Launch --
66

7-
## Launch docker-compose as background daemon
7+
## Launch docker compose as background daemon
88
.PHONY: up
99
up: build init
1010

11-
12-
.PHONY: build
13-
build:
14-
docker-compose -f docker-compose.yml -f docker/${PHP}.yml up -d
15-
16-
## Shut down docker-compose services
11+
## Shut down docker compose services
1712
.PHONY: down
1813
down:
19-
docker-compose -f docker-compose.yml -f docker/${PHP}.yml down
14+
docker compose -f docker-compose.yml -f docker/${PHP}.yml down
2015

2116
## Initialise repository - run install-magento
2217
.PHONY: init
2318
init:
24-
docker-compose exec -T web dockerize -wait tcp://db:3306 -wait tcp://elasticsearch:9200 -timeout 60m /usr/local/bin/install-magento
19+
docker compose exec -T web dockerize -wait tcp://db:3306 -wait tcp://elasticsearch:9200 -timeout 60m /usr/local/bin/install-magento
2520

2621
## -- Development Methods --
2722

2823
## Run magento upgrade
2924
.PHONY: upgrade
3025
upgrade:
31-
docker-compose exec web /usr/local/bin/upgrade-magento
26+
docker compose exec web /usr/local/bin/upgrade-magento
3227

3328
## Deploy static content
3429
.PHONY: static_deploy
3530
static_deploy:
36-
docker-compose exec web /usr/local/bin/compile-magento
31+
docker compose exec web /usr/local/bin/compile-magento
3732

3833
## Launch bash shell into magento container
3934
.PHONY: shell
4035
shell:
41-
docker-compose exec web bash
36+
docker compose exec web bash
4237

4338
.PHONY: shell-db
4439
shell-db:
45-
docker-compose exec db bash
40+
docker compose exec db bash
4641

4742
## Enable magento cache. Should be disabled to load extensions
4843
.PHONY: cache-enable
4944
cache-enable:
50-
docker-compose exec web /var/www/html/bin/magento cache:enable
45+
docker compose exec web /var/www/html/bin/magento cache:enable
5146

5247
## Disable magento cache
5348
.PHONY: cache-disable
5449
cache-disable:
55-
docker-compose exec web /var/www/html/bin/magento cache:disable
50+
docker compose exec web /var/www/html/bin/magento cache:disable
5651

5752
## Flush cache
5853
.PHONY: cache-flush
5954
cache-flush:
60-
docker-compose exec -T web /var/www/html/bin/magento cache:flush
55+
docker compose exec -T web /var/www/html/bin/magento cache:flush
6156

6257
## Set base URL as 127.0.0.1 instead of localhost - fixes session expirey issue
6358
.PHONY: set-base-url
6459
set-base-url:
65-
docker-compose exec -T db mysql -u magento -pmagento -D magento -e 'UPDATE `core_config_data` SET `value`="http://127.0.0.1:3000/" WHERE path="web/secure/base_url"'
60+
docker compose exec -T db mysql -u magento -pmagento -D magento -e 'UPDATE `core_config_data` SET `value`="http://127.0.0.1:3000/" WHERE path="web/secure/base_url"'
6661

6762
## Fix for session expired error in development
6863
.PHONY: fix-session-expire
@@ -71,12 +66,12 @@ fix-session-expire: set-base-url cache-flush
7166
## Tail logs
7267
.PHONY: logs
7368
logs:
74-
docker-compose logs -f
69+
docker compose logs -f
7570

7671
## Tail magento logs only
7772
.PHONY: logs-magento
7873
logs-magento:
79-
docker-compose logs -f web
74+
docker compose logs -f web
8075

8176
## -- Misc --
8277

@@ -125,3 +120,7 @@ help:
125120
} \
126121
}' \
127122
$(MAKEFILE_LIST)
123+
124+
.PHONY: build
125+
build:
126+
docker compose -f docker-compose.yml -f docker/${PHP}.yml up -d --wait

docker-compose.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
1-
version: '3.0'
1+
version: '3.8'
22
services:
33
db:
44
image: library/mariadb:10.4-bionic
55
volumes:
66
- db-data:/var/lib/mysql/data
77
env_file:
88
- ./docker/.env
9+
healthcheck:
10+
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
11+
interval: 10s
12+
timeout: 5s
13+
retries: 5
914
web:
1015
build: .
1116
ports:
1217
- "3000:80"
13-
links:
14-
- db
18+
depends_on:
19+
db:
20+
condition: service_healthy
1521
env_file:
1622
- ./docker/.env
1723
volumes:
1824
- ".:/var/www/html/app/code/Idealpostcodes/Ukaddresssearch"
25+
healthcheck:
26+
test: ["CMD", "curl", "-f", "http://localhost:80/health"]
27+
interval: 30s
28+
timeout: 10s
29+
retries: 3
1930

2031
phpmyadmin:
2132
image: phpmyadmin/phpmyadmin
2233
ports:
2334
- "8580:80"
24-
links:
25-
- db
35+
depends_on:
36+
db:
37+
condition: service_healthy
2638
volumes:
2739
db-data:

0 commit comments

Comments
 (0)