Skip to content

Commit

Permalink
fix: mysql (#2)
Browse files Browse the repository at this point in the history
* Create docker-image.yml

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile
  • Loading branch information
Simoneu01 authored Jan 14, 2024
1 parent 1370183 commit d4b95c7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 19 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -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)
36 changes: 17 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -42,32 +59,13 @@ 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 \
&& apt-get update -y \
&& 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 \
Expand Down

0 comments on commit d4b95c7

Please sign in to comment.