revisão no docker

This commit is contained in:
Renan Bernordi 2025-01-29 23:40:28 -03:00
parent d8568c06e9
commit 9ffd8260fd
4 changed files with 35 additions and 23 deletions

View file

@ -1,5 +1,5 @@
name: 🛠️ Main
run-name: 🚀 Deploy de versão
run-name: 🚀 Version Deployment
on:
push:
@ -12,29 +12,29 @@ env:
jobs:
docker-build:
name: 🐳 Build e Push
name: 🐳 Build and Push
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: 📥 Checkout código
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🏷️ Extrair versão da tag
- name: 🏷️ Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: 🔧 Configurar QEMU
- name: 🔧 Set up QEMU
uses: docker/setup-qemu-action@v3
- name: 🛠️ Configurar Docker Buildx
- name: 🛠️ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: 📋 Extrair metadata Docker
- name: 📋 Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
@ -44,14 +44,14 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: 🔐 Login no Registry
- name: 🔐 Log in to Registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏗️ Build e Push
- name: 🏗️ Build and Push
uses: docker/build-push-action@v5
with:
context: .
@ -63,21 +63,21 @@ jobs:
cache-to: type=gha,mode=max
publish-release:
name: 📦 Publicar Release
name: 📦 Publish Release
runs-on: ubuntu-latest
needs: docker-build
permissions:
contents: write
steps:
- name: 📥 Checkout código
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🏷️ Extrair versão da tag
- name: 🏷️ Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: 📝 Criar Release
- name: 📝 Create Release
uses: softprops/action-gh-release@v1
with:
name: "🎉 Release v${{ steps.get_version.outputs.VERSION }}"

View file

@ -1,4 +1,5 @@
FROM php:8.3-fpm
# Stage 1: Build stage
FROM php:8.3-fpm AS builder
# Install PHP dependencies and extensions
RUN apt-get update && apt-get install -y \
@ -12,25 +13,33 @@ RUN apt-get update && apt-get install -y \
libhiredis-dev \
&& docker-php-ext-install zip opcache \
&& pecl install redis \
&& docker-php-ext-enable redis opcache
&& docker-php-ext-enable redis opcache \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy OPCache configuration
COPY opcache.ini /usr/local/etc/php/conf.d/opcache.ini
# Install Composer
RUN curl -sS https: //getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Copy webservice configuration
COPY default.conf /etc/nginx/sites-available/default
# Create and copy app folder
RUN mkdir -p /app
# Copy app folder
COPY app/ /app/
# Install composer packages
WORKDIR /app
RUN composer install --no-interaction --optimize-autoloader
# Stage 2: Final stage
FROM php:8.3-fpm
# Copy necessary files from the builder stage
COPY --from=builder /usr/local/etc/php/conf.d/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
COPY --from=builder /usr/local/bin/composer /usr/local/bin/composer
COPY --from=builder /app /app
# Copy webservice configuration
COPY default.conf /etc/nginx/sites-available/default
# Copy and configure initialization script permissions
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
@ -44,4 +53,4 @@ RUN chown -R www-data:www-data /app \
EXPOSE 80
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

0
app/assets/.dockerignore Normal file
View file

View file

@ -1,4 +1,6 @@
#!/bin/bash
# Terminate the script immediately on error
set -e
###########################################
# Docker Entrypoint
@ -51,6 +53,7 @@ log_success "Environment variables configured"
# Permissions Adjustment
log_info "Adjusting directory permissions..."
mkdir -p /app/cache /app/logs # Ensures directories exist
chown -R www-data:www-data /app/cache /app/logs
chmod -R 775 /app/cache /app/logs
@ -111,4 +114,4 @@ echo -e "\n${GREEN}=== Marreta initialized ===${NC}\n"
wait -n
# Exit with status of process that exited first
exit $?
exit $?