Refactoring

This commit is contained in:
2023-01-04 17:30:37 +02:00
parent df9eaa22ae
commit b41dc0d28f
6 changed files with 51 additions and 39 deletions

View File

@@ -1,32 +1,15 @@
name: Docker build name: Build
on: on:
# Allows you to run this workflow manually from the Actions tab push:
workflow_dispatch: branches:
inputs: - main
docker_tag:
description: 'Docker tag'
required: true
default: 'latest'
type: string
env: env:
#BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILDKIT_IMAGE: jkaninda/laravel-php-fpm BUILDKIT_IMAGE: jkaninda/laravel-php-fpm
jobs: jobs:
docker: docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
-
name: Set environment for branch
run: |
set -x
if [[ ${{ inputs.docker_tag }} == 'latest' ]]; then
TAG_NAME=8.1
echo "Build latest tag'"
else
TAG_NAME=${{ inputs.docker_tag }}
fi
- -
name: Set up QEMU name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
@@ -40,10 +23,32 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
name: Build and push name: Build and push 7.4
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
with: with:
context: ./ file: "./docker/7.4/Dockerfile"
file: "./docker/${{TAG_NAME}}/Dockerfile"
push: true push: true
tags: "${{env.BUILDKIT_IMAGE}}:${{env.TAG_NAME}}" tags: "${{env.BUILDKIT_IMAGE}}:7.4"
-
name: Build and push 8.0
uses: docker/build-push-action@v3
with:
file: "./docker/8.0/Dockerfile"
push: true
tags: "${{env.BUILDKIT_IMAGE}}:8.0"
-
name: Build and push 8.1
uses: docker/build-push-action@v3
with:
file: "./docker/8.1/Dockerfile"
push: true
tags: "${{env.BUILDKIT_IMAGE}}:8.1"
-
name: Build and push 8.2
uses: docker/build-push-action@v3
with:
file: "./docker/8.2/Dockerfile"
push: true
tags: |
"${{env.BUILDKIT_IMAGE}}:8.2"
"${{env.BUILDKIT_IMAGE}}:latest"

View File

@@ -11,7 +11,7 @@ then
docker build -f docker/${tag}/Dockerfile -t jkaninda/laravel-php-fpm:$tag . docker build -f docker/${tag}/Dockerfile -t jkaninda/laravel-php-fpm:$tag .
else else
echo 'Build latest' echo 'Build latest'
docker build -f docker/8.1/Dockerfile -t jkaninda/laravel-php-fpm:$tag . docker build -f docker/8.2/Dockerfile -t jkaninda/laravel-php-fpm:$tag .
fi fi

View File

@@ -3,6 +3,8 @@ ARG WORKDIR=/var/www/html
ENV DOCUMENT_ROOT=${WORKDIR} ENV DOCUMENT_ROOT=${WORKDIR}
ENV LARAVEL_PROCS_NUMBER=1 ENV LARAVEL_PROCS_NUMBER=1
ENV NODE_VERSION=16.x ENV NODE_VERSION=16.x
ARG HOST_UID=1000
ENV USER=www-data
# Install system dependencies # Install system dependencies
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
git \ git \
@@ -82,8 +84,8 @@ ENTRYPOINT ["entrypoint.sh"]
RUN usermod -u 1000 www-data RUN usermod -u ${HOST_UID} www-data
RUN groupmod -g 1000 www-data RUN groupmod -g ${HOST_UID} www-data
RUN chmod -R 755 $WORKDIR RUN chmod -R 755 $WORKDIR
RUN chown -R www-data:www-data $WORKDIR RUN chown -R www-data:www-data $WORKDIR

View File

@@ -3,6 +3,8 @@ ARG WORKDIR=/var/www/html
ENV DOCUMENT_ROOT=${WORKDIR} ENV DOCUMENT_ROOT=${WORKDIR}
ENV LARAVEL_PROCS_NUMBER=1 ENV LARAVEL_PROCS_NUMBER=1
ENV NODE_VERSION=16.x ENV NODE_VERSION=16.x
ARG HOST_UID=1000
ENV USER=www-data
# Install system dependencies # Install system dependencies
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
git \ git \
@@ -82,8 +84,8 @@ ENTRYPOINT ["entrypoint.sh"]
RUN usermod -u 1000 www-data RUN usermod -u ${HOST_UID} www-data
RUN groupmod -g 1000 www-data RUN groupmod -g ${HOST_UID} www-data
RUN chmod -R 755 $WORKDIR RUN chmod -R 755 $WORKDIR
RUN chown -R www-data:www-data $WORKDIR RUN chown -R www-data:www-data $WORKDIR

View File

@@ -1,8 +1,10 @@
FROM php:8.1.11-fpm FROM php:8.1.13-fpm
ARG WORKDIR=/var/www/html ARG WORKDIR=/var/www/html
ENV DOCUMENT_ROOT=${WORKDIR} ENV DOCUMENT_ROOT=${WORKDIR}
ENV LARAVEL_PROCS_NUMBER=1 ENV LARAVEL_PROCS_NUMBER=1
ENV NODE_VERSION=17.x ENV NODE_VERSION=17.x
ARG HOST_UID=1000
ENV USER=www-data
# Install system dependencies # Install system dependencies
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
git \ git \
@@ -81,9 +83,8 @@ RUN ln -s /usr/local/bin/entrypoint.sh /
ENTRYPOINT ["entrypoint.sh"] ENTRYPOINT ["entrypoint.sh"]
RUN usermod -u ${HOST_UID} www-data
RUN usermod -u 1000 www-data RUN groupmod -g ${HOST_UID} www-data
RUN groupmod -g 1000 www-data
RUN chmod -R 755 $WORKDIR RUN chmod -R 755 $WORKDIR
RUN chown -R www-data:www-data $WORKDIR RUN chown -R www-data:www-data $WORKDIR

View File

@@ -1,8 +1,10 @@
FROM php:8.2.0RC5-fpm FROM php:8.2.0-fpm
ARG WORKDIR=/var/www/html ARG WORKDIR=/var/www/html
ENV DOCUMENT_ROOT=${WORKDIR} ENV DOCUMENT_ROOT=${WORKDIR}
ENV LARAVEL_PROCS_NUMBER=1 ENV LARAVEL_PROCS_NUMBER=1
ENV NODE_VERSION=17.x ENV NODE_VERSION=17.x
ARG HOST_UID=1000
ENV USER=www-data
# Install system dependencies # Install system dependencies
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
git \ git \
@@ -24,9 +26,9 @@ RUN apt-get update && apt-get install -y \
nano \ nano \
cron cron
#RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
# Install Node # Install Node
#RUN apt-get install -y nodejs RUN apt-get install -y nodejs
# Clear cache # Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/* RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Kafka # Install Kafka
@@ -82,8 +84,8 @@ ENTRYPOINT ["entrypoint.sh"]
RUN usermod -u 1000 www-data RUN usermod -u ${HOST_UID} www-data
RUN groupmod -g 1000 www-data RUN groupmod -g ${HOST_UID} www-data
RUN chmod -R 755 $WORKDIR RUN chmod -R 755 $WORKDIR
RUN chown -R www-data:www-data $WORKDIR RUN chown -R www-data:www-data $WORKDIR