diff --git a/docker-compose.yml b/docker-compose.yml index 1a9563e2b..753bb5ba2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,173 +42,105 @@ services: APP_USER: my_user APP_USER_PASSWORD: password_i_should_change command: tail -F anything - php-oracle: + depends_on: + mysql: + condition: service_healthy + mariadb: + condition: service_healthy + postgres: + condition: service_healthy + mssql: + condition: service_healthy + oracle: + condition: service_healthy + mysql: + image: mysql:9 + ports: + - "3306:3306" + volumes: + - type: tmpfs + target: /var/lib/mysql + environment: + MYSQL_DATABASE: yii + MYSQL_ROOT_PASSWORD: root + MYSQL_ROOT_HOST: "%" + healthcheck: + test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost", "-uroot" ] + interval: 5s + timeout: 5s + retries: 20 + mariadb: + image: mariadb:11 + ports: + - "13306:3306" + volumes: + - type: tmpfs + target: /var/lib/mysql + environment: + MYSQL_DATABASE: yii + MYSQL_ROOT_PASSWORD: root + MYSQL_ROOT_HOST: "%" + MYSQL_TCP_PORT: 13306 + healthcheck: + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + start_period: 10s + interval: 10s + timeout: 5s + retries: 30 + postgres: + image: postgres:17 + ports: + - "5432:5432" + volumes: + - type: tmpfs + target: /var/lib/postgresql/data + environment: + POSTGRES_DB: yii + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres" ] + interval: 5s + timeout: 5s + retries: 5 + mssql: + image: mcr.microsoft.com/mssql/server:2022-latest + ports: + - "1433:1433" + user: root + volumes: + - mssql-data:/var/opt/mssql/data + - mssql-log:/var/opt/mssql/log + - mssql-secrets:/var/opt/mssql/secrets + environment: + SA_PASSWORD: YourStrong!Passw0rd + ACCEPT_EULA: Y + healthcheck: + test: /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$${SA_PASSWORD}" -Q "SELECT 1" -b -C -o /dev/null + interval: 10s + timeout: 3s + retries: 100 + start_period: 10s + oracle: build: - context: docker/oracle + context: docker/oracle ports: - "1521:1521" volumes: - - ./src:/code/src - - ./tests:/code/tests - - ./composer.json:/code/composer.json - - ./phpunit.xml.dist:/code/phpunit.xml.dist - - php-oracle-data:/opt/oracle/oradata + - oracle-data:/opt/oracle/oradata environment: - YII_MYSQL_DATABASE: yii - YII_MYSQL_HOST: mysql - YII_MYSQL_PORT: 3306 - YII_MYSQL_USER: root - YII_MYSQL_PASSWORD: root - YII_MYSQL_TYPE: mysql - - YII_MARIADB_DATABASE: yii - YII_MARIADB_HOST: mariadb - YII_MARIADB_PORT: 13306 - YII_MARIADB_USER: root - YII_MARIADB_PASSWORD: root - - YII_PGSQL_DATABASE: yii - YII_PGSQL_HOST: postgres - YII_PGSQL_PORT: 5432 - YII_PGSQL_USER: postgres - YII_PGSQL_PASSWORD: postgres - - YII_MSSQL_DATABASE: tempdb - YII_MSSQL_HOST: mssql - YII_MSSQL_PORT: 1433 - YII_MSSQL_USER: SA - YII_MSSQL_PASSWORD: YourStrong!Passw0rd - - YII_ORACLE_SID: FREE - YII_ORACLE_HOST: 172.17.0.1 - YII_ORACLE_PORT: 1521 - YII_ORACLE_USER: system - YII_ORACLE_PASSWORD: sys_user_password - ORACLE_PASSWORD: sys_user_password APP_USER: my_user APP_USER_PASSWORD: password_i_should_change - command: tail -F anything -# depends_on: -# mysql: -# condition: service_healthy -# mariadb: -# condition: service_healthy -# postgres: -# condition: service_healthy -# mssql: -# condition: service_healthy -# oracle: -# condition: service_healthy -# mysql: -# image: mysql:9 -# ports: -# - "3306:3306" -# volumes: -# - type: tmpfs -# target: /var/lib/mysql -# environment: -# MYSQL_DATABASE: yii -# MYSQL_ROOT_PASSWORD: root -# MYSQL_ROOT_HOST: "%" -# healthcheck: -# test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost", "-uroot" ] -# interval: 5s -# timeout: 5s -# retries: 20 -# mariadb: -# image: mariadb:11 -# ports: -# - "13306:3306" -# volumes: -# - type: tmpfs -# target: /var/lib/mysql -# environment: -# MYSQL_DATABASE: yii -# MYSQL_ROOT_PASSWORD: root -# MYSQL_ROOT_HOST: "%" -# MYSQL_TCP_PORT: 13306 -# healthcheck: -# test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] -# start_period: 10s -# interval: 10s -# timeout: 5s -# retries: 30 -# postgres: -# image: postgres:17 -# ports: -# - "5432:5432" -# volumes: -# - type: tmpfs -# target: /var/lib/postgresql/data -# environment: -# POSTGRES_DB: yii -# POSTGRES_USER: postgres -# POSTGRES_PASSWORD: postgres -# healthcheck: -# test: [ "CMD-SHELL", "pg_isready -U postgres" ] -# interval: 5s -# timeout: 5s -# retries: 5 -# mssql: -# image: mcr.microsoft.com/mssql/server:2022-latest -# ports: -# - "1433:1433" -# user: root -# volumes: -# - mssql-data:/var/opt/mssql/data -# - mssql-log:/var/opt/mssql/log -# - mssql-secrets:/var/opt/mssql/secrets -# environment: -# SA_PASSWORD: YourStrong!Passw0rd -# ACCEPT_EULA: Y -# healthcheck: -# test: /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$${SA_PASSWORD}" -Q "SELECT 1" -b -C -o /dev/null -# interval: 10s -# timeout: 3s -# retries: 100 -# start_period: 10s -# oracle: -# build: -# context: docker/oracle -# ports: -# - "1521:1521" -# volumes: -# - oracle-data:/opt/oracle/oradata -# environment: -# ORACLE_PASSWORD: sys_user_password -# APP_USER: my_user -# APP_USER_PASSWORD: password_i_should_change -# healthcheck: -# test: ["CMD", "healthcheck.sh"] -# interval: 10s -# timeout: 5s -# retries: 100 -# start_period: 5s -# start_interval: 5s -# test1: -# build: -# context: docker/test1 -# volumes: -# - test1-oracle-data:/opt/oracle/oradata -# environment: -# ORACLE_PASSWORD: sys_user_password -# APP_USER: my_user -# APP_USER_PASSWORD: password_i_should_change -# command: tail -F anything - # entrypoint: /opt/oracle/container-entrypoint.sh -# healthcheck: -# test: [ "CMD", "/opt/oracle/healthcheck.sh" ] -# interval: 10s -# timeout: 5s -# retries: 100 -# start_period: 5s -# start_interval: 5s + healthcheck: + test: ["CMD", "healthcheck.sh"] + interval: 10s + timeout: 5s + retries: 100 + start_period: 5s + start_interval: 5s volumes: - php-oracle-data: mssql-data: mssql-log: mssql-secrets: oracle-data: - # test-oracle-data: - test1-oracle-data: diff --git a/docker/oracle/Dockerfile b/docker/oracle/Dockerfile index a9b71e7ff..cc7e1498a 100644 --- a/docker/oracle/Dockerfile +++ b/docker/oracle/Dockerfile @@ -1,28 +1,3 @@ -FROM --platform=linux/amd64 db-php:latest AS php - -FROM gvenzl/oracle-free:23 AS oracle - -COPY --from=php /usr/local/lib/php/ /usr/local/lib/php/ -COPY --from=php /usr/local/include/php/ /usr/local/include/php/ -COPY --from=php /usr/local/php/ /usr/local/php/ -COPY --from=php /usr/local/bin/php /usr/local/bin/php -COPY --from=php /usr/local/bin/php-config /usr/local/bin/php-config -COPY --from=php /usr/local/etc/php/ /usr/local/etc/php/ - -COPY --from=php /usr/lib/x86_64-linux-gnu/*.so* /usr/lib/x86_64-linux-gnu/ -COPY --from=php /usr/lib/x86_64-linux-gnu/*.so* /usr/lib64/ - -COPY --from=php /opt/* /opt/ -COPY --from=php /usr/local/instantclient_23_5/ /usr/local/instantclient_23_5/ - -COPY --from=php /code/ /code/ - -COPY --from=php /root/.bashrc /root/.bashrc - -USER root -RUN ln -s /usr/local/instantclient_23_5 /usr/local/instantclient -RUN ln -s /usr/local/instantclient/lib* /usr/lib -RUN ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus -USER oracle +FROM gvenzl/oracle-free:23 RUN chown -R 54321:54321 /opt/oracle/oradata && chmod 0777 /opt/oracle/oradata diff --git a/docker/test/Dockerfile b/docker/test/Dockerfile deleted file mode 100644 index 1935f888e..000000000 --- a/docker/test/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM gvenzl/oracle-free:23 AS oracle - -RUN chown -R 54321:54321 /opt/oracle/oradata && chmod 0777 /opt/oracle/oradata - -RUN ls - -# COPY ./container-entrypoint-custom.sh ./container-entrypoint-custom.sh -# RUN ["chmod", "+x", "container-entrypoint-custom.sh"] -# RUN ORACLE_PASSWORD=sys_user_password container-entrypoint-custom.sh - -FROM php:8.3-cli AS php - -COPY --from=oracle /opt/oracle/ /opt/oracle/ -COPY --from=oracle /usr/bin/7zzs /usr/bin/7zzs - -ENV PATH="$PATH:/opt/oracle/product/23ai/dbhomeFree/bin:/opt/oracle" - -RUN apt-get update && apt-get install -y \ - # Oracle - libaio1 - -ENV ORACLE_SID=FREE -ENV ORACLE_BASE=/opt/oracle -ENV ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree -ENV ORACLE_BASE_HOME=/opt/oracle/product/23ai/dbhomeFree -ENV NLS_LANG=.AL32UTF8 -ENV ORACLE_BASE_CONFIG=/opt/oracle/product/23ai/dbhomeFree - -RUN groupadd -g 54321 oracle -RUN useradd oracle -u 54321 -g 54321 -m -s /bin/bash -RUN chown -R 54321:54321 /opt/oracle - -# ENTRYPOINT ["/opt/oracle/container-entrypoint.sh"] diff --git a/docker/test1/Dockerfile b/docker/test1/Dockerfile deleted file mode 100644 index 3e01fa40e..000000000 --- a/docker/test1/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM php:8.3-cli AS php - -FROM gvenzl/oracle-free:23 AS oracle - -COPY --from=php /usr/local/lib/php/ /usr/local/lib/php/ -COPY --from=php /usr/local/include/php/ /usr/local/include/php/ -COPY --from=php /usr/local/php/ /usr/local/php/ -COPY --from=php /usr/local/bin/php /usr/local/bin/php -COPY --from=php /usr/local/bin/php-config /usr/local/bin/php-config -COPY --from=php /usr/local/etc/php/ /usr/local/etc/php/ - -COPY --from=php /usr/lib/x86_64-linux-gnu/*.so* /usr/lib/x86_64-linux-gnu/ -COPY --from=php /usr/lib/x86_64-linux-gnu/*.so* /usr/lib64/ -COPY --from=php /usr/bin/ldd /usr/bin/ldd - -RUN chown -R 54321:54321 /opt/oracle/oradata && chmod 0777 /opt/oracle/oradata