diff options
author | Ryan Chu <ryan.chu@qt.io> | 2019-03-22 16:20:52 +0100 |
---|---|---|
committer | Ryan Chu <ryan.chu@qt.io> | 2019-04-25 15:32:57 +0000 |
commit | 713f77176e5de34503bd265e00f665b7f6ef05b4 (patch) | |
tree | 7be1f245a087bca7385676b2af6d038461a48d38 /tests/testserver/docker-compose.yml | |
parent | 0c404fd6f34c7ca75400324e95e44842152bdd87 (diff) |
Support multi-stage builds to provision the configurations and test data
In order to reuse the test server to the external modules, it is much
easier to share the common configurations (scripts) and test data via
Dockerfile. In addition, the external module can create more layers
depending on their needs. Therefore, supporting multi-stage builds is
needed. The disadvantage is that the docker-compose needs to re-build
the images every time. However, it is just a one-time effort. If the
Dockerfile doesn't get changed, the extra build time can be ignored.
Because of multi-stage builds, the test server will keep a Dockerfile at
least. Therefore, the volume sharing is no more needed. The test data of
a service can be added into the images by using COPY/ADD commands.
NOTE:
This patch relies on docker-compose v1.21.0 (docker-compose build now
supports the use of Dockerfile from outside the build context).
Change-Id: Ib3f6a5fcf6979732ae8a40a494a1360fca4ac7bf
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/testserver/docker-compose.yml')
-rw-r--r-- | tests/testserver/docker-compose.yml | 124 |
1 files changed, 78 insertions, 46 deletions
diff --git a/tests/testserver/docker-compose.yml b/tests/testserver/docker-compose.yml index 962daad3c9..75e8a0fea2 100644 --- a/tests/testserver/docker-compose.yml +++ b/tests/testserver/docker-compose.yml @@ -12,18 +12,21 @@ version: '3.4' services: apache2: - image: qt-test-server-apache2:537fe302f61851d1663f41495230d8e3554a4a13 container_name: qt-test-server-apache2 domainname: ${TEST_DOMAIN} hostname: apache2 - volumes: - - ./common:/common:ro - - ./apache2:/service:ro - entrypoint: common/startup.sh - command: [common/ssl.sh, service/apache2.sh] + build: + context: . + dockerfile: ${SHARED_DATA}/Dockerfile + args: + provisioningImage: qt-test-server-apache2:537fe302f61851d1663f41495230d8e3554a4a13 + shareDir: ./common + serviceDir: ./apache2 + test_domain: ${TEST_DOMAIN} + entrypoint: service/startup.sh + command: [service/ssl.sh, service/apache2.sh] squid: - image: qt-test-server-squid:9c32f41b19aca3d778733c4d8fb0ecc5955e893c container_name: qt-test-server-squid domainname: ${TEST_DOMAIN} hostname: squid @@ -35,25 +38,33 @@ services: - iptables:iptables.${TEST_DOMAIN} - vsftpd:vsftpd.${TEST_DOMAIN} - echo:echo.${TEST_DOMAIN} - volumes: - - ./common:/common:ro - - ./squid:/service:ro - entrypoint: common/startup.sh + build: + context: . + dockerfile: ${SHARED_DATA}/Dockerfile + args: + provisioningImage: qt-test-server-squid:9c32f41b19aca3d778733c4d8fb0ecc5955e893c + shareDir: ./common + serviceDir: ./squid + test_domain: ${TEST_DOMAIN} + entrypoint: service/startup.sh command: service/squid.sh vsftpd: - image: qt-test-server-vsftpd:f3a9c8d793a77cc007c0e4e481bec01f9e3eeb7e container_name: qt-test-server-vsftpd domainname: ${TEST_DOMAIN} hostname: vsftpd - volumes: - - ./common:/common:ro - - ./vsftpd:/service:ro - entrypoint: common/startup.sh + build: + context: . + dockerfile: ${SHARED_DATA}/Dockerfile + args: + provisioningImage: qt-test-server-vsftpd:f3a9c8d793a77cc007c0e4e481bec01f9e3eeb7e + shareDir: ./common + serviceDir: ./vsftpd + test_domain: ${TEST_DOMAIN} + entrypoint: service/startup.sh command: service/vsftpd.sh ftp-proxy: - image: qt-test-server-ftp-proxy:d7de8b28392d173db512a558ccc84ead8bece2ae container_name: qt-test-server-ftp-proxy domainname: ${TEST_DOMAIN} hostname: ftp-proxy @@ -61,14 +72,18 @@ services: - vsftpd external_links: - vsftpd:vsftpd.${TEST_DOMAIN} - volumes: - - ./common:/common:ro - - ./ftp-proxy:/service:ro - entrypoint: common/startup.sh + build: + context: . + dockerfile: ${SHARED_DATA}/Dockerfile + args: + provisioningImage: qt-test-server-ftp-proxy:d7de8b28392d173db512a558ccc84ead8bece2ae + shareDir: ./common + serviceDir: ./ftp-proxy + test_domain: ${TEST_DOMAIN} + entrypoint: service/startup.sh command: service/ftp-proxy.sh danted: - image: qt-test-server-danted:35607f9b790524cf9690c7d12a9a401696b7b6b5 container_name: qt-test-server-danted domainname: ${TEST_DOMAIN} hostname: danted @@ -82,44 +97,61 @@ services: - ftp-proxy:ftp-proxy.${TEST_DOMAIN} - cyrus:cyrus.${TEST_DOMAIN} - echo:echo.${TEST_DOMAIN} - volumes: - - ./common:/common:ro - - ./danted:/service:ro - entrypoint: common/startup.sh + build: + context: . + dockerfile: ${SHARED_DATA}/Dockerfile + args: + provisioningImage: qt-test-server-danted:35607f9b790524cf9690c7d12a9a401696b7b6b5 + shareDir: ./common + serviceDir: ./danted + test_domain: ${TEST_DOMAIN} + entrypoint: service/startup.sh command: service/danted.sh cyrus: - image: qt-test-server-cyrus:c8d72754abc0e501afd624ce838e4df35505abc9 container_name: qt-test-server-cyrus domainname: ${TEST_DOMAIN} hostname: cyrus - volumes: - - ./common:/common:ro - - ./cyrus:/service:ro - entrypoint: common/startup.sh - command: [common/ssl.sh, service/cyrus.sh] + build: + context: . + dockerfile: ${SHARED_DATA}/Dockerfile + args: + provisioningImage: qt-test-server-cyrus:c8d72754abc0e501afd624ce838e4df35505abc9 + shareDir: ./common + serviceDir: ./cyrus + test_domain: ${TEST_DOMAIN} + entrypoint: service/startup.sh + command: [service/ssl.sh, service/cyrus.sh] iptables: - image: qt-test-server-iptables:cb7a8bd6d28602085a88c8ced7d67e28e75781e2 container_name: qt-test-server-iptables domainname: ${TEST_DOMAIN} hostname: iptables - volumes: - - ./common:/common:ro - - ./iptables:/service:ro - entrypoint: common/startup.sh + build: + context: . + dockerfile: ${SHARED_DATA}/Dockerfile + args: + provisioningImage: qt-test-server-iptables:cb7a8bd6d28602085a88c8ced7d67e28e75781e2 + shareDir: ./common + serviceDir: ./iptables + test_domain: ${TEST_DOMAIN} + entrypoint: service/startup.sh command: service/iptables.sh cap_add: - NET_ADMIN - NET_RAW echo: - image: qt-test-server-echo:b29ad409e746a834c1055fd0f7a55fd5056da6ea - container_name: qt-test-server-echo - domainname: ${TEST_DOMAIN} - hostname: echo - volumes: - - ./common:/common:ro - - ./echo:/service:ro - entrypoint: common/startup.sh - command: service/echo.sh + container_name: qt-test-server-echo + domainname: ${TEST_DOMAIN} + hostname: echo + build: + context: . + dockerfile: ${SHARED_DATA}/Dockerfile + args: + provisioningImage: qt-test-server-echo:b29ad409e746a834c1055fd0f7a55fd5056da6ea + shareDir: ./common + serviceDir: ./echo + test_domain: ${TEST_DOMAIN} + entrypoint: service/startup.sh + command: service/echo.sh |