Skip to content

Commit 18d28ed

Browse files
committed
Upgrade docker-compose to work with symfony package
1 parent f93444e commit 18d28ed

File tree

5 files changed

+16
-37
lines changed

5 files changed

+16
-37
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ You can set up your local environment natively or using `docker`, check out the
3838

3939
Example of running all the checks with docker:
4040
```bash
41-
docker-compose run --rm package bash -c "list of the commands required to build + run tests + run linters"
41+
docker-compose run --rm package bash -c "composer install && composer test:unit && composer lint:check"
4242
```
4343

4444
To install dependencies:
@@ -93,7 +93,7 @@ Each Pull Request should pass the tests, and the linter to be accepted.
9393

9494
```sh
9595
# Tests
96-
docker-compose exec -e MEILISEARCH_URL=http://meilisearch:7700 php composer test:unit
96+
docker-compose exec -e MEILISEARCH_HOST=http://meilisearch:7700 php composer test:unit
9797
# Linter
9898
docker-compose exec php composer lint:check
9999
# Linter (with auto-fix)

Dockerfile

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,17 @@
1-
FROM php:8.0-fpm-alpine as php
2-
3-
# persistent / runtime deps
4-
RUN apk add --no-cache \
5-
acl \
6-
fcgi \
7-
file \
8-
gettext \
9-
git \
10-
;
1+
FROM php:8.0-fpm as php
112

123
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
134
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
145
ENV COMPOSER_ALLOW_SUPERUSER=1
156

16-
WORKDIR /usr/src
17-
18-
# prevent the reinstallation of vendors at every changes in the source code
19-
COPY composer.json ./
20-
RUN set -eux; \
21-
composer install; \
22-
composer clear-cache
23-
24-
# copy only specifically what we need
25-
COPY src src/
26-
COPY tests tests/
7+
RUN apt-get update && apt-get install -y \
8+
libfcgi0ldbl \
9+
zlib1g-dev \
10+
gettext \
11+
libzip-dev \
12+
unzip \
13+
git
2714

28-
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
29-
RUN chmod +x /usr/local/bin/docker-entrypoint
15+
RUN docker-php-ext-install zip
3016

31-
ENTRYPOINT ["docker-entrypoint"]
3217
CMD ["php-fpm"]

docker-compose.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
version: "3.8"
2-
3-
# remove this line if you don't need a volume to map your dependencies
4-
# volumes:
5-
# bundle:
1+
version: '3.8'
62

73
services:
84
package:
9-
image: language-name:version
5+
build: .
106
tty: true
117
stdin_open: true
128
working_dir: /home/package
139
environment:
1410
- MEILISEARCH_HOST=http://meilisearch:7700
15-
- MEILISEARCH_PORT=7700
1611
depends_on:
1712
- meilisearch
1813
links:
1914
- meilisearch
2015
volumes:
21-
# - bundle:/vendor/bundle
22-
- ./:/home/package
16+
- ./:/home/package:rw,cached
2317

2418
meilisearch:
2519
image: getmeili/meilisearch:latest

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<env name="APP_ENV" value="test"/>
1313
<env name="APP_DEBUG" value="false"/>
1414
<env name="MEILISEARCH_PREFIX" value="sf_phpunit_"/>
15-
<env name="MEILISEARCH_URL" value="http://127.0.0.1:7700"/>
15+
<env name="MEILISEARCH_HOST" value="http://127.0.0.1:7700"/>
1616
<env name="MEILISEARCH_API_KEY" value="masterKey"/>
1717
<env name="TRAVIS_JOB_NUMBER" value=""/>
1818
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>

tests/config/meili_search.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
meili_search:
2-
url: '%env(MEILISEARCH_URL)%'
2+
url: '%env(MEILISEARCH_HOST)%'
33
api_key: '%env(MEILISEARCH_API_KEY)%'
44
prefix: '%env(MEILISEARCH_PREFIX)%_'
55
nbResults: 12

0 commit comments

Comments
 (0)