Skip to content

Commit 6faad9b

Browse files
committed
Added Dockerfile and Makefile for setting up a build environment for this library
1 parent f278172 commit 6faad9b

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM php:7.4-cli as php
2+
3+
FROM php AS build
4+
5+
# Use the default production configuration
6+
RUN cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
7+
8+
# libxml2: xml
9+
# libedit: opcache
10+
# git, zip: composer
11+
# wget: mysql
12+
13+
RUN apt-get update && apt-get install -y \
14+
libedit-dev \
15+
git \
16+
zip
17+
18+
RUN docker-php-ext-install -j$(nproc) \
19+
mysqli \
20+
pdo_mysql
21+
22+
FROM build as configure
23+
24+
RUN echo "date.timezone = UTC" > /usr/local/etc/php/conf.d/tz.ini \
25+
&& echo "memory_limit = -1" > /usr/local/etc/php/conf.d/memory_limit.ini
26+
27+
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/local/bin/ --filename=composer;
28+
29+
WORKDIR /usr/src/api

Makefile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MY_USER_ID=$(shell id -u)
2+
MY_GROUP_ID=$(shell id -g)
3+
4+
.PHONY: build
5+
build:
6+
docker build -t enobrev-php-tools .
7+
8+
.PHONY: composer-install
9+
composer-install:
10+
docker run -i -t --rm -u $(MY_USER_ID):$(MY_GROUP_ID) -v $(PWD):/usr/src/api enobrev-php-tools composer install
11+
12+
.PHONY: composer-update
13+
composer-update:
14+
docker run -i -t --rm -u $(MY_USER_ID):$(MY_GROUP_ID) -v $(PWD):/usr/src/api enobrev-php-tools composer update
15+
16+
.PHONY: composer-upgrade
17+
composer-upgrade:
18+
docker run -i -t --rm -u $(MY_USER_ID):$(MY_GROUP_ID) -v $(PWD):/usr/src/api enobrev-php-tools composer upgrade
19+
20+
.PHONY: test
21+
test:
22+
docker run -i -t --rm -u $(MY_USER_ID):$(MY_GROUP_ID) -v $(PWD):/usr/src/api enobrev-php-tools vendor/bin/phpunit tests

0 commit comments

Comments
 (0)