-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,38 +2,20 @@ FROM alpine:latest | |
|
||
LABEL maintainer="[email protected]" | ||
|
||
ARG UID=1337 | ||
ARG GID=1337 | ||
ENV RESTORE false | ||
ENV ARCHIVE_FILE "" | ||
|
||
ENV DEV_PACKAGES="\ | ||
gcc \ | ||
libc-dev \ | ||
libffi-dev \ | ||
py3-pip \ | ||
python3-dev \ | ||
" | ||
RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ | ||
&& apk --no-cache add python3-dev libffi-dev gcc libc-dev py3-pip py3-cffi py3-cryptography ca-certificates bash | ||
|
||
ENV PACKAGES="\ | ||
bash \ | ||
ca-certificates \ | ||
py3-cffi \ | ||
py3-cryptography \ | ||
py3-six \ | ||
" | ||
WORKDIR /opt/grafana-backup-tool | ||
ADD . /opt/grafana-backup-tool | ||
|
||
RUN chmod -R a+r /opt/grafana-backup-tool \ | ||
&& find /opt/grafana-backup-tool -type d -print0 | xargs -0 chmod a+rx | ||
|
||
RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ | ||
&& apk add --no-cache --virtual build-deps ${DEV_PACKAGES} \ | ||
&& apk add --no-cache ${PACKAGES} \ | ||
&& pip3 --no-cache-dir install . \ | ||
&& chown -R ${UID}:${GID} /opt/grafana-backup-tool \ | ||
&& apk del build-deps | ||
RUN pip3 --no-cache-dir install . | ||
|
||
USER ${UID} | ||
RUN chown -R 1337:1337 /opt/grafana-backup-tool | ||
USER 1337 | ||
CMD sh -c 'if [ "$RESTORE" = true ]; then if [ ! -z "$AWS_S3_BUCKET_NAME" ] || [ ! -z "$AZURE_STORAGE_CONTAINER_NAME" ]; then grafana-backup restore $ARCHIVE_FILE; else grafana-backup restore _OUTPUT_/$ARCHIVE_FILE; fi else grafana-backup save; fi' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM alpine:latest | ||
|
||
LABEL maintainer="[email protected]" | ||
|
||
ARG UID=1337 | ||
ARG GID=1337 | ||
ENV RESTORE false | ||
ENV ARCHIVE_FILE "" | ||
|
||
ENV DEV_PACKAGES="\ | ||
gcc \ | ||
libc-dev \ | ||
libffi-dev \ | ||
py3-pip \ | ||
python3-dev \ | ||
" | ||
|
||
ENV PACKAGES="\ | ||
bash \ | ||
ca-certificates \ | ||
py3-cffi \ | ||
py3-cryptography \ | ||
py3-six \ | ||
" | ||
WORKDIR /opt/grafana-backup-tool | ||
ADD . /opt/grafana-backup-tool | ||
|
||
RUN chmod -R a+r /opt/grafana-backup-tool \ | ||
&& find /opt/grafana-backup-tool -type d -print0 | xargs -0 chmod a+rx | ||
|
||
RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ | ||
&& apk add --no-cache --virtual build-deps ${DEV_PACKAGES} \ | ||
&& apk add --no-cache ${PACKAGES} \ | ||
&& pip3 --no-cache-dir install . \ | ||
&& chown -R ${UID}:${GID} /opt/grafana-backup-tool \ | ||
&& apk del build-deps | ||
|
||
USER ${UID} | ||
CMD sh -c 'if [ "$RESTORE" = true ]; then if [ ! -z "$AWS_S3_BUCKET_NAME" ] || [ ! -z "$AZURE_STORAGE_CONTAINER_NAME" ]; then grafana-backup restore $ARCHIVE_FILE; else grafana-backup restore _OUTPUT_/$ARCHIVE_FILE; fi else grafana-backup save; fi' |