diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..ef8c2a0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+.github
+.DS_Store
+README.md
+LICENSE
\ No newline at end of file
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
new file mode 100644
index 0000000..9121b63
--- /dev/null
+++ b/.github/workflows/docker-image.yml
@@ -0,0 +1,43 @@
+name: Docker Image CI
+
+on:
+ push:
+ branches:
+ - 'main'
+ tags:
+ - 'v*'
+
+jobs:
+ push_to_registry:
+ name: Push Docker image to Docker Hub
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out the repo
+ uses: actions/checkout@v4
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Log in to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Extract metadata (tags, labels) for Docker
+ id: meta
+ uses: docker/metadata-action@v5.5.1
+ with:
+ images: joanfabregat/mysql-s3-backup
+
+ - name: Build and push Docker image
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ platforms: linux/amd64,linux/arm64
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..496ee2c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.DS_Store
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..0f70ef1
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/mysql-s3-backup.iml b/.idea/mysql-s3-backup.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/mysql-s3-backup.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
new file mode 100644
index 0000000..f324872
--- /dev/null
+++ b/.idea/php.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..9327e06
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,15 @@
+FROM debian:bookworm-slim
+
+RUN apt-get update && apt-get install -y default-mysql-client awscli gzip
+
+ARG MYSQL_PORT=3306
+ARG S3_PREFIX=/
+
+ENV MYSQL_PORT=$MYSQL_PORT
+ENV S3_PREFIX=$S3_PREFIX
+
+WORKDIR /app
+COPY run.sh .
+RUN chmod +x run.sh
+
+CMD ["sh", "run.sh"]
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..770b4b0
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,7 @@
+Copyright 2024 Code Inc. / Joan Fabrégat
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..51f8621
--- /dev/null
+++ b/README.md
@@ -0,0 +1,22 @@
+# MySQL S3 backup
+
+This repository contains a script to backup a MySQL database to an S3 bucket.
+
+## Usage
+
+## Configuration
+
+| Environment variables | Description | Default |
+|-------------------------|-------------------|------------|
+| `MYSQL_HOST` | MySQL host | *required* |
+| `MYSQL_PORT` | MySQL port | `3306` |
+| `MYSQL_USER` | MySQL user | *required* |
+| `MYSQL_PASSWORD` | MySQL password | *required* |
+| `MYSQL_DATABASE` | MySQL database | *required* |
+| `S3_BUCKET` | S3 bucket | *required* |
+| `S3_PREFIX` | S3 prefix | `/` |
+| `AWS_ACCESS_KEY_ID` | AWS access key ID | *required* |
+| `AWS_SECRET_ACCESS_KEY` | AWS secret | *required* |
+| `AWS_DEFAULT_REGION` | AWS region | *required* |
+
+## Kubernetes CRON
diff --git a/run.sh b/run.sh
new file mode 100644
index 0000000..4334ec6
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Dump MySQL database
+mysqldump -h $MYSQL_HOST -P $MYSQL_PORT -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE > /tmp/$MYSQL_DATABASE.sql | gzip -c > /tmp/$MYSQL_DATABASE.sql.gz
+
+# Upload to S3
+aws s3 cp /tmp/$MYSQL_DATABASE.sql.gz s3://mybucket/$MYSQL_DATABASE.sql.gz
+
+# Remove dump
+rm /tmp/$MYSQL_DATABASE.sql.gz
\ No newline at end of file