Skip to content

Commit d8331a4

Browse files
committed
Refactored .ci with CMD in Dockerfile
1 parent c8c619a commit d8331a4

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

.ci/Dockerfile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
ARG PHP_VERSION=7.4-cli
22
FROM php:${PHP_VERSION}
33

4+
WORKDIR /usr/src/app
5+
46
# Install git
57
RUN apt-get update && \
68
apt-get install -y --no-install-recommends git
@@ -15,4 +17,19 @@ RUN apt-get install -y \
1517
RUN php -v
1618

1719
# Install composer
18-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
20+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
21+
22+
# Print composer version
23+
RUN composer --version
24+
25+
COPY composer.json .
26+
27+
# Install dependencies with composer
28+
RUN composer global require hirak/prestissimo && composer install
29+
30+
COPY . .
31+
32+
# Updating elasticsearch submodule
33+
RUN git submodule update --init --recursive
34+
35+
CMD ["bash", ".ci/yaml-tests.sh"]

.ci/run-repository.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ echo -e "\033[34;1mINFO:\033[0m PHP_VERSION ${PHP_VERSION}\033[0m"
2222
echo -e "\033[1m>>>>> Build docker container >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
2323

2424
docker build \
25+
--no-cache \
2526
--file .ci/Dockerfile \
2627
--tag elastic/elasticsearch-php \
2728
--build-arg PHP_VERSION=${PHP_VERSION} \
@@ -33,13 +34,12 @@ repo=$(realpath $(dirname $(realpath -s $0))/../)
3334

3435
docker run \
3536
--network=${network_name} \
36-
--volume $repo:/usr/src/app \
37+
--workdir="/usr/src/app" \
3738
--env STACK_VERSION=${STACK_VERSION} \
3839
--env TEST_SUITE=${TEST_SUITE} \
3940
--env PHP_VERSION=${PHP_VERSION} \
4041
--env ELASTICSEARCH_URL=${ELASTICSEARCH_URL} \
4142
--ulimit nofile=65535:65535 \
4243
--name elasticsearch-php \
4344
--rm \
44-
elastic/elasticsearch-php
45-
/bin/bash .ci/yaml-tests.sh
45+
elastic/elasticsearch-php

.ci/yaml-tests.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22

3-
composer install
4-
git submodule update --init --recursive
3+
# Checkout the YAML test from Elasticsearch tag
54
php util/RestSpecRunner.php
5+
6+
# Run YAML tests
67
vendor/bin/phpunit -c phpunit-integration.xml --group sync

0 commit comments

Comments
 (0)