Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ pipeline {
steps {
script {
echo 'Execução do PHPUnit...'
sh """
echo "TEST_DB_HOST=db_test" > .env
echo "TEST_DB_DATABASE=web_storage_test" >> .env
echo "TEST_DB_USERNAME=test_user" >> .env
echo "TEST_DB_PASSWORD=test_pass" >> .env
echo "TEST_POSTGRES_DB=web_storage_test" >> .env
echo "TEST_POSTGRES_USER=test_user" >> .env
echo "TEST_POSTGRES_PASSWORD=test_pass" >> .env
echo "STORAGE_TYPE=oci" >> .env
echo "STORAGE_ROOT=/var/www/html/storage" >> .env
"""
sh './run-tests.sh'
}
}
Expand All @@ -18,6 +29,10 @@ pipeline {
stage('Build Imagem de Produção') {
steps {
script {
echo 'Configurando credenciais OCI para o build...'
withCredentials([file(credentialsId: 'web_storage_oci_private_key_file', variable: 'OCI_KEY_FILE')]) {
sh "mkdir -p .oci && cp \$OCI_KEY_FILE .oci/server1.pem"
}
echo 'Build da imagem...'
sh 'docker compose -f docker-compose.prod.yml build';
}
Expand All @@ -32,12 +47,32 @@ pipeline {
withCredentials([
string(credentialsId: 'web_storage_prod_db_name', variable: 'WEB_STORAGE_PROD_DB_NAME'),
string(credentialsId: 'web_storage_prod_db_user', variable: 'WEB_STORAGE_PROD_DB_USER'),
string(credentialsId: 'web_storage_prod_db_pass', variable: 'WEB_STORAGE_PROD_DB_PASS')
string(credentialsId: 'web_storage_prod_db_pass', variable: 'WEB_STORAGE_PROD_DB_PASS'),

string(credentialsId: 'web_storage_oci_tenancy_ocid', variable: 'OCI_TENANCY_OCID'),
string(credentialsId: 'web_storage_oci_user_ocid', variable: 'OCI_USER_OCID'),
string(credentialsId: 'web_storage_oci_fingerprint', variable: 'OCI_FINGERPRINT'),
string(credentialsId: 'web_storage_oci_region', variable: 'OCI_REGION'),
string(credentialsId: 'web_storage_oci_namespace', variable: 'OCI_NAMESPACE'),
string(credentialsId: 'web_storage_oci_bucket', variable: 'OCI_BUCKET')
]) {
sh """
echo "WEB_STORAGE_PROD_DB_NAME=${WEB_STORAGE_PROD_DB_NAME}" > .env
echo "WEB_STORAGE_PROD_DB_USER=${WEB_STORAGE_PROD_DB_USER}" >> .env
echo "WEB_STORAGE_PROD_DB_PASS=${WEB_STORAGE_PROD_DB_PASS}" >> .env
echo "PROD_DB_HOST=10.0.0.110" > .env
echo "PROD_DB_DATABASE=${WEB_STORAGE_PROD_DB_NAME}" >> .env
echo "PROD_DB_USERNAME=${WEB_STORAGE_PROD_DB_USER}" >> .env
echo "PROD_DB_PASSWORD=${WEB_STORAGE_PROD_DB_PASS}" >> .env
echo "PROD_POSTGRES_DB=${WEB_STORAGE_PROD_DB_NAME}" >> .env
echo "PROD_POSTGRES_USER=${WEB_STORAGE_PROD_DB_USER}" >> .env
echo "PROD_POSTGRES_PASSWORD=${WEB_STORAGE_PROD_DB_PASS}" >> .env
echo "STORAGE_TYPE=oci" >> .env
echo "STORAGE_ROOT=/var/www/html/storage" >> .env
echo "OCI_KEY_FILE=/var/www/html/.oci/server1.pem" >> .env
echo "OCI_TENANCY_OCID=${OCI_TENANCY_OCID}" >> .env
echo "OCI_USER_OCID=${OCI_USER_OCID}" >> .env
echo "OCI_FINGERPRINT=${OCI_FINGERPRINT}" >> .env
echo "OCI_REGION=${OCI_REGION}" >> .env
echo "OCI_NAMESPACE=${OCI_NAMESPACE}" >> .env
echo "OCI_BUCKET=${OCI_BUCKET}" >> .env
"""

sh '''
Expand Down
1 change: 1 addition & 0 deletions docker/php/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ RUN composer install --no-dev --optimize-autoloader --no-scripts || true

# Set permissions for storage
RUN mkdir -p storage && chmod -R 777 storage
RUN chown -R www-data:www-data .oci && chmod 600 .oci/server1.pem
Loading