This repository has been archived by the owner on Jun 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.j2
63 lines (52 loc) · 1.9 KB
/
Dockerfile.j2
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
{% if ARCH == "arm" %}
FROM golang:1.13 as builder
RUN set -x \
&& cd /opt \
&& git clone https://github.com/minio/mc -b {{ VERSION }} \
&& cd /opt/mc \
&& GOOS=linux GOARCH=arm go build -tags kqueue -o /usr/bin/mc \
&& test -f /usr/bin/mc
{% endif %}
FROM {{ IMAGE }}
LABEL maintainer="RiotKit" \
org.label-schema.name="riot-mc-mirror" \
org.label-schema.arch="{{ ARCH }}" \
org.label-schema.description="Minio Client packed with crontab and programmed to synchronize two buckets" \
org.label-schema.url="https://github.com/riotkit-org" \
org.label-schema.vcs-url="https://github.com/riotkit-org/riot-mc-mirror" \
org.label-schema.vendor="RiotKit" \
org.label-schema.version="{{ VERSION }}"
ENV SOURCE_URL=http://primary.backups.example.org \
# Access token to access resources on source S3
SOURCE_ACCESS_TOKEN=some-token \
# Secret to access resources on source S3
SOURCE_SECRET=some-secret \
# Bucket name from which the data will be copied from
SOURCE_BUCKET=test-src-bucket \
# URL of the target S3 where the files will be synchronized to
TARGET_URL=http://some-minio-instance \
# Access to the copy target
TARGET_ACCESS_TOKEN=test \
# Access to the copy target
TARGET_SECRET=test \
# Bucket name on target S3
TARGET_BUCKET=test-bucket \
# Options passed to "mc mirror" command
MIRROR_OPTS=--json \
# Crontab schedule
CRON_SCHEDULE="*/5 * * * *"
COPY bin/*.sh /
{% if ARCH == "arm" %}
COPY --from=builder /usr/bin/mc /usr/bin/mc
RUN [ "cross-build-start" ]
{% endif %}
RUN apk add --update bash sed \
&& addgroup -g 1050 mirroring_comrade \
&& adduser -D -u 1050 -G mirroring_comrade mirroring_comrade \
&& chmod +x /*.sh {% if ARCH != "arm" %}\
&& /download_minio_version.sh {{ VERSION }}
{% endif %}
{% if ARCH == "arm" %}
RUN [ "cross-build-end" ]
{% endif %}
ENTRYPOINT "/mirroring_entrypoint.sh"