Skip to content

Commit 0343a61

Browse files
committed
Add local docker env setup
1 parent 21b3213 commit 0343a61

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM php:8.4-cli
2+
3+
RUN apt-get update && apt-get install -y \
4+
git \
5+
unzip \
6+
$PHPIZE_DEPS \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
RUN pecl install pcov && docker-php-ext-enable pcov
10+
11+
RUN echo "pcov.enabled=1" > /usr/local/etc/php/conf.d/99-pcov.ini
12+
13+
COPY --from=composer/composer:latest-bin /composer /usr/local/bin/composer
14+
15+
WORKDIR /app

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
IMAGE_NAME := json-diff
3+
CURRENT_DIR := $(shell pwd)
4+
5+
.PHONY: help
6+
7+
# COLORS
8+
GREEN := $(shell tput -Txterm setaf 2)
9+
YELLOW := $(shell tput -Txterm setaf 3)
10+
WHITE := $(shell tput -Txterm setaf 7)
11+
RESET := $(shell tput -Txterm sgr0)
12+
13+
TARGET_MAX_CHAR_NUM=20
14+
15+
## Show help
16+
help:
17+
@echo ''
18+
@echo 'Usage:'
19+
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
20+
@echo ''
21+
@echo 'Targets:'
22+
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
23+
helpMessage = match(lastLine, /^## (.*)/); \
24+
if (helpMessage) { \
25+
helpCommand = substr($$1, 0, index($$1, ":")-1); \
26+
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
27+
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
28+
} \
29+
} \
30+
{ lastLine = $$0 }' $(MAKEFILE_LIST)
31+
32+
## Start and log into the container
33+
up: build run
34+
35+
## Build a new version of the container
36+
build:
37+
@docker build -t $(IMAGE_NAME) .
38+
39+
## Run the existing container
40+
run:
41+
@docker run -it --rm -v "$(CURRENT_DIR):/app" $(IMAGE_NAME) bash

0 commit comments

Comments
 (0)