-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
26 lines (25 loc) · 740 Bytes
/
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
FROM python:3.7-alpine as base
FROM base as builder
COPY requirements.txt /requirements.txt
RUN pip install --prefix=/install -r /requirements.txt --no-warn-script-location
FROM base
COPY --from=builder /install /usr/local
ARG database='postgresql'
ENV DATABASENAME $database
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apk add zip
RUN mkdir /code
WORKDIR /code
COPY backup-cron /etc/cron.d/backup-cron
RUN chmod 0644 /etc/cron.d/backup-cron
RUN crontab /etc/cron.d/backup-cron
COPY start.sh /code/start.sh
RUN chmod 0667 /code/start.sh
COPY dockerfile.sh /dockerfile.sh
RUN chmod 777 /dockerfile.sh
RUN sh /dockerfile.sh
RUN rm /dockerfile.sh
VOLUME /data
COPY "backup-${database}.py" /code/backup.py
CMD ["/code/start.sh"]