-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
87 lines (70 loc) · 3.05 KB
/
Dockerfile
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
FROM --platform=$BUILDPLATFORM golang:1.22.5-alpine3.19 AS builder
ENV GO111MODULE=on
# Copy the go source
COPY go /workspace
WORKDIR /workspace
RUN go mod tidy
# Build
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o ./_output/bin/azure_restore ./cmd/main.go
FROM ubuntu:22.04
ENV PGPASSWORD=password PG_CLUSTER_NAME=common STORAGE_ROOT=/backup-storage EXTERNAL_STORAGE_ROOT=/external \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8
COPY docker/pip.conf /root/.pip/pip.conf
COPY docker/requirements.txt /root/requirements.txt
RUN echo "deb [trusted=yes] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
RUN cat /etc/apt/sources.list
RUN ls -la /etc/apt/
RUN apt-get -y update
RUN apt-get -o DPkg::Options::="--force-confnew" -y dist-upgrade
RUN apt-get update && \
apt-get install -y --allow-downgrades gcc-12 cpp-12 gcc-12-base libgcc-12-dev libstdc++6 libgcc-s1 libnsl2
RUN apt-get --no-install-recommends install -y python3.11 python3-pip python3-dev libpq-dev cython3
RUN ls -ls /usr/bin/
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get --no-install-recommends install -y comerr-dev \
unzip \
build-essential \
manpages-dev \
libkrb5-dev \
libsasl2-dev libldap2-dev libssl-dev \
postgresql-13 postgresql-14 postgresql-15 postgresql-16 \
jq \
openssl curl
RUN python3 -m pip install -U setuptools==70.0.0
RUN python3 -m pip install --no-cache-dir -r /root/requirements.txt \
&& python3 -m pip install --upgrade pip \
&& python3 -m pip install grpcio \
&& python3 -m pip install opentelemetry-distro opentelemetry-exporter-otlp opentelemetry-api opentelemetry-sdk opentelemetry-instrumentation-flask \
&& opentelemetry-bootstrap -a install \
&& pip3 uninstall -y pip \
&& apt-get remove -y --purge gcc-12 \
&& apt-get remove -y --purge python3-dev \
&& apt-get remove -y --purge libpq-dev \
&& apt-get remove -y --purge cython3 \
&& apt-get clean
RUN ln -s /usr/bin/python3 /usr/bin/python
COPY --from=builder /workspace/_output/bin/azure_restore /opt/backup/
COPY docker/postgres/ docker/health.sh /opt/backup/
COPY docker/granular /opt/backup/granular
COPY docker/postgres/encryption.py /opt/backup/granular/encryption.py
COPY docker/external_scripts/azure_restore.sh /opt/backup/
COPY maintenance /maintenance
RUN mkdir -p /backup-storage/ && \
mkdir -p /external/ && \
chmod -R +x /opt/backup/ && \
chmod -R 777 /opt/backup/ && \
chmod -R 777 /backup-storage/ && \
chmod -R 777 /external/ && \
chmod -R g+w /maintenance/recovery/ && \
chmod +x /maintenance/recovery/*.sh && \
chgrp -R 0 /backup-storage/ && \
chgrp -R 0 /external/
#VOLUME /backup-storage
#VOLUME /external
# Volumes are defined to support read-only root file system
VOLUME /etc
VOLUME /opt/backup
VOLUME /tmp
EXPOSE 8080 8081 8082 9000
CMD ["bash", "/opt/backup/start_backup_daemon.sh"]