forked from valentinyanakiev/kubernetes-cloud-mysql-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-MySQL
51 lines (42 loc) · 1.55 KB
/
Dockerfile-MySQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Set the base image to MySQL 8.3.0, which uses microdnf
FROM mysql:8.3.0
# Install additional required packages
USER root
# Install system packages
RUN microdnf update && \
microdnf install -y \
python3-pip \
less \
mailcap \
curl \
gnupg \
gzip \
git \
go && \
microdnf clean all
# Install Python packages
RUN pip3 install --upgrade awscli s3cmd python-magic awscli-plugin-endpoint
# Install kubectl
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
rm kubectl
# Set Default Environment Variables
ENV BACKUP_CREATE_DATABASE_STATEMENT=false \
TARGET_DATABASE_PORT=3306 \
CLOUD_SDK_VERSION=367.0.0 \
# Release commit for https://github.com/FiloSottile/age
AGE_VERSION=552aa0a07de0b42c16126d3107bd8895184a69e7 \
AWS_REGION="nl-ams"
# Install FiloSottile/age for encryption, adjusting for the go environment
RUN git clone https://github.com/FiloSottile/age.git /tmp/age && \
cd /tmp/age/cmd/age && \
git checkout $AGE_VERSION && \
go build -o /usr/local/bin/age && \
rm -rf /tmp/age
# Copy Scaleway configuration files from build context to the container
COPY ./scaleway/config /root/.aws/config
# Assume you have a backup script that uses mysqldump, pg_dump, awscli, etc.
COPY resources/perform-backup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/perform-backup.sh
# Set the entrypoint to execute the backup script
CMD ["/usr/local/bin/perform-backup.sh"]