diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..d7999b8 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,19 @@ +name: Docker Image CI + +on: + workflow_dispatch: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build-image: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build the Docker image + run: docker build . --file Dockerfile --tag php-docker:$(date +%s) diff --git a/Dockerfile b/Dockerfile index 8a518ff..1cae0db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,23 @@ RUN curl -fLo docker.tgz https://download.docker.com/linux/static/stable/x86_64/ "https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-amd64" \ && chmod +x /usr/local/lib/docker/cli-plugins/docker-buildx +FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-jammy + +ENV DEBIAN_FRONTEND=noninteractive +ENV RUNNER_MANUALLY_TRAP_SIG=1 +ENV ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT=1 +ENV ImageOS=ubuntu22 + +RUN apt-get update -y \ + && apt-get install -y --no-install-recommends \ + sudo \ + lsb-release \ + git \ + curl \ + unzip \ + gpg \ + && rm -rf /var/lib/apt/lists/* + # Install MariaDB RUN apt-get update -y \ && apt-get install -y --no-install-recommends \ @@ -42,11 +59,6 @@ RUN apt-get update -y \ # Configure MariaDB RUN echo 'sort_buffer_size = 256000000' >> /etc/mysql/mariadb.conf.d/50-server.cnf -# Set the root password for MariaDB -RUN service mariadb start \ - && mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';" \ - && service mariadb stop - # Install Redis RUN curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg \ && echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list \ @@ -54,20 +66,6 @@ RUN curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/ && apt-get install -y --no-install-recommends \ redis \ && rm -rf /var/lib/apt/lists/* - -FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-jammy - -ENV DEBIAN_FRONTEND=noninteractive -ENV RUNNER_MANUALLY_TRAP_SIG=1 -ENV ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT=1 -ENV ImageOS=ubuntu22 - -RUN apt-get update -y \ - && apt-get install -y --no-install-recommends \ - sudo \ - lsb-release \ - git \ - && rm -rf /var/lib/apt/lists/* RUN adduser --disabled-password --gecos "" --uid 1001 runner \ && groupadd docker --gid 123 \