Skip to content

Commit 15aa584

Browse files
committed
minor #636 [Lazy] - Upgrade lazy stack to PHP8.3 (gfaivre)
This PR was merged into the master branch. Discussion ---------- [Lazy] - Upgrade lazy stack to PHP8.3 Commits ------- 85c5557 [Lazy] - Upgrade lazy stack to PHP8.3
2 parents 0c3ce26 + 85c5557 commit 15aa584

25 files changed

+661
-145
lines changed

.manala.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ project:
1919

2020
system:
2121
nginx:
22-
version: "1.20"
22+
version: 1.24
2323
port: 8000
2424
php:
25-
version: 8.1
25+
version: 8.3
2626
extensions:
2727
- gd
2828
nodejs:

.manala/Makefile

+15-11
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ MANALA_DOCKER_COMPOSE_ENV += \
2525
MANALA_DIR=$(realpath $(MANALA_DIR)) \
2626
MANALA_CACHE_DIR=$(realpath $(shell dir=$(MANALA_DIR)/$(MANALA_CACHE_DIR) ; mkdir -p $${dir} ; echo $${dir}))
2727

28-
define manala_docker_command
29-
$(manala_docker_compose) exec \
30-
--user lazy \
31-
$(1) \
32-
system
33-
endef
28+
# Command
29+
MANALA_DOCKER_COMMAND = exec --user lazy
30+
MANALA_DOCKER_COMMAND_SERVICE = system
31+
32+
# Services
3433

3534
##########
3635
# System #
@@ -41,11 +40,11 @@ ifndef MANALA_DOCKER
4140

4241
MANALA_HELP += $(call manala_help_section, System)
4342

44-
MANALA_HELP += $(call manala_help,up, Create and start local system (WAIT))
43+
MANALA_HELP += $(call manala_help,up, Create and start local system (WAIT|DEBUG))
44+
up: MANALA_DOCKER_DEBUG = $(if $(DEBUG),1)
4545
up:
4646
@$(call manala_log, Builds$(,) creates and starts docker containers…)
4747
$(manala_docker_compose) up \
48-
--build \
4948
$(if $(WAIT), --wait)
5049
.PHONY: up
5150

@@ -55,9 +54,14 @@ stop:
5554
$(manala_docker_compose) stop
5655
.PHONY: stop
5756

58-
MANALA_HELP += $(call manala_help,sh, Open a local system shell)
57+
MANALA_HELP += $(call manala_help,sh, Shell to local system (DIR))
58+
sh: MANALA_DOCKER_COMMAND_DIR ?= $(if $(findstring command line,$(origin DIR)),$(DIR))
5959
sh:
60-
$(manala_docker_command) bash --login
60+
if [ ! -t 0 ] ; then \
61+
$(call manala_docker_command, --no-TTY) sh -s ; \
62+
else \
63+
$(manala_docker_command) bash --login ; \
64+
fi
6165
.PHONY: sh
6266

6367
MANALA_HELP += $(call manala_help,clean,Clean local system)
@@ -72,7 +76,7 @@ clean:
7276
$(manala_docker) images \
7377
--filter reference='elao:*' \
7478
--format "{{.ID}}" \
75-
| xargs $(manala_docker) rmi --force
79+
| xargs -r $(manala_docker) rmi --force
7680
@$(call manala_log, Delete cache dir…)
7781
rm -Rf $(MANALA_DIR)/$(MANALA_CACHE_DIR)
7882
.PHONY: clean

.manala/README.md

+145
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,148 @@ rsync -a /tmp/foo/ ./
3333
```
3434

3535
Browse http://localhost:8080 and enjoy :)
36+
37+
## Usage
38+
39+
### Shell
40+
41+
Open a shell to container
42+
```shell
43+
make sh
44+
```
45+
46+
Run commands through container shell
47+
```shell
48+
# From file
49+
make sh < file
50+
# Multilines, using heredoc
51+
make sh << 'EOF'
52+
command 1
53+
command 2
54+
...
55+
EOF
56+
# Single line
57+
make sh <<< command
58+
```
59+
60+
Specify working dir
61+
```shell
62+
make sh DIR=/etc <<< pwd
63+
/etc
64+
```
65+
66+
### Makefile
67+
68+
One of the first directive of your project's Makefile should be to include manala recipe `Makefile`
69+
```makefile
70+
include .manala/Makefile
71+
```
72+
73+
Or, if you're not sure manala recipe directory will be present, make it optional. If you do make it optionnal, you'll have to ensure that every parts of you project's Makefile using manala recipe tools could fallback to another solution.
74+
```makefile
75+
-include .manala/Makefile
76+
```
77+
78+
Note: it's a good practise to have a `.SILENT:` as the first line of your project's Makefile. Not only does it globally silence make targets echoing, but it also offers a lowcost debugging system by just commenting it on demand.
79+
```makefile
80+
.SILENT:
81+
```
82+
```makefile
83+
#.SILENT:
84+
```
85+
86+
A `MANALA_DOCKER` variable is available to check whether you're inside the container or not
87+
```makefile
88+
foo:
89+
ifdef MANALA_DOCKER
90+
echo Inside container
91+
else
92+
echo Outside container
93+
endif
94+
```
95+
96+
A `MANALA_DIR` variable is available to get your project's directory *inside* container
97+
```makefile
98+
foo:
99+
echo Project directory is $(MANALA_DIR)
100+
```
101+
102+
There are three ways to force your project's Makefile target execution inside container:
103+
104+
1. Function `manala_docker_shell`
105+
106+
```makefile
107+
foo:
108+
echo Can be run *inside* or *outside* container
109+
$(call manala_docker_shell, echo Always run *inside* container)
110+
```
111+
112+
2. Shell substitution with `MANALA_DOCKER_SHELL`
113+
114+
```makefile
115+
foo: SHELL := $(MANALA_DOCKER_SHELL)
116+
foo:
117+
echo Always run *inside* container
118+
119+
# Or, if you're not sure manala recipe "Makefile" will be included
120+
foo: SHELL := $(or $(MANALA_DOCKER_SHELL),$(SHELL))
121+
foo:
122+
echo Can be run *inside* or *outside* container, \
123+
but always *inside* if manala recipe "Makefile" is included
124+
```
125+
126+
3. Make substitution with `MANALA_DOCKER_MAKE`
127+
128+
```makefile
129+
foo:
130+
$(MANALA_DOCKER_MAKE) bar
131+
132+
bar:
133+
echo Run *outside* container if called directly \
134+
or *inside* container if called from "foo"
135+
```
136+
137+
An automagic target help system is included out-of-the-box. You can list all available documented commands with `make help` (or just `make`, as the help command is the default one)
138+
139+
```shell
140+
$ make
141+
142+
Usage: make [command]
143+
144+
Help:
145+
help This help
146+
147+
System:
148+
sh Open a local system shell
149+
clean Clean local system
150+
```
151+
152+
You can add your own documented commands, by adding double dashed comments in your projects's Makefile
153+
```makefile
154+
## This is foo
155+
foo:
156+
...
157+
158+
## Bar - Use the "Bar" help section
159+
bar.baz:
160+
...
161+
```
162+
163+
```shell
164+
$ make
165+
166+
Usage: make [command]
167+
168+
Help:
169+
help This help
170+
171+
System:
172+
sh Open a local system shell
173+
clean Clean local system
174+
175+
Commands:
176+
foo This is foo
177+
178+
Bar:
179+
bar.baz Use the "Bar" help section
180+
```

0 commit comments

Comments
 (0)