mirror of
https://github.com/manualdousuario/marreta.git
synced 2025-09-01 02:00:10 +00:00
revisão no docker
This commit is contained in:
parent
d8568c06e9
commit
9ffd8260fd
4 changed files with 35 additions and 23 deletions
26
.github/workflows/release.yml
vendored
26
.github/workflows/release.yml
vendored
|
@ -1,5 +1,5 @@
|
||||||
name: 🛠️ Main
|
name: 🛠️ Main
|
||||||
run-name: 🚀 Deploy de versão
|
run-name: 🚀 Version Deployment
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -12,29 +12,29 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker-build:
|
docker-build:
|
||||||
name: 🐳 Build e Push
|
name: 🐳 Build and Push
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Checkout código
|
- name: 📥 Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 🏷️ Extrair versão da tag
|
- name: 🏷️ Extract version from tag
|
||||||
id: get_version
|
id: get_version
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: 🔧 Configurar QEMU
|
- name: 🔧 Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- name: 🛠️ Configurar Docker Buildx
|
- name: 🛠️ Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
|
||||||
- name: 📋 Extrair metadata Docker
|
- name: 📋 Extract Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
|
@ -44,14 +44,14 @@ jobs:
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
type=sha
|
type=sha
|
||||||
|
|
||||||
- name: 🔐 Login no Registry
|
- name: 🔐 Log in to Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.DOCKER_REGISTRY }}
|
registry: ${{ env.DOCKER_REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: 🏗️ Build e Push
|
- name: 🏗️ Build and Push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
@ -63,21 +63,21 @@ jobs:
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
publish-release:
|
publish-release:
|
||||||
name: 📦 Publicar Release
|
name: 📦 Publish Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: docker-build
|
needs: docker-build
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Checkout código
|
- name: 📥 Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 🏷️ Extrair versão da tag
|
- name: 🏷️ Extract version from tag
|
||||||
id: get_version
|
id: get_version
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: 📝 Criar Release
|
- name: 📝 Create Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
name: "🎉 Release v${{ steps.get_version.outputs.VERSION }}"
|
name: "🎉 Release v${{ steps.get_version.outputs.VERSION }}"
|
||||||
|
|
27
Dockerfile
27
Dockerfile
|
@ -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
|
# Install PHP dependencies and extensions
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
|
@ -12,25 +13,33 @@ RUN apt-get update && apt-get install -y \
|
||||||
libhiredis-dev \
|
libhiredis-dev \
|
||||||
&& docker-php-ext-install zip opcache \
|
&& docker-php-ext-install zip opcache \
|
||||||
&& pecl install redis \
|
&& 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 configuration
|
||||||
COPY opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
COPY opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
||||||
|
|
||||||
# Install Composer
|
# 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 app folder
|
||||||
COPY default.conf /etc/nginx/sites-available/default
|
|
||||||
|
|
||||||
# Create and copy app folder
|
|
||||||
RUN mkdir -p /app
|
|
||||||
COPY app/ /app/
|
COPY app/ /app/
|
||||||
|
|
||||||
# Install composer packages
|
# Install composer packages
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN composer install --no-interaction --optimize-autoloader
|
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 and configure initialization script permissions
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
|
@ -44,4 +53,4 @@ RUN chown -R www-data:www-data /app \
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
0
app/assets/.dockerignore
Normal file
0
app/assets/.dockerignore
Normal file
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Terminate the script immediately on error
|
||||||
|
set -e
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# Docker Entrypoint
|
# Docker Entrypoint
|
||||||
|
@ -51,6 +53,7 @@ log_success "Environment variables configured"
|
||||||
# Permissions Adjustment
|
# Permissions Adjustment
|
||||||
log_info "Adjusting directory permissions..."
|
log_info "Adjusting directory permissions..."
|
||||||
|
|
||||||
|
mkdir -p /app/cache /app/logs # Ensures directories exist
|
||||||
chown -R www-data:www-data /app/cache /app/logs
|
chown -R www-data:www-data /app/cache /app/logs
|
||||||
chmod -R 775 /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
|
wait -n
|
||||||
|
|
||||||
# Exit with status of process that exited first
|
# Exit with status of process that exited first
|
||||||
exit $?
|
exit $?
|
Loading…
Add table
Reference in a new issue