File tree Expand file tree Collapse file tree 3 files changed +63
-26
lines changed Expand file tree Collapse file tree 3 files changed +63
-26
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,30 @@ jobs:
21
21
22
22
- name : Extract metadata (tags, labels) for Docker
23
23
id : meta
24
- uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
24
+ uses : docker/metadata-action@v4
25
25
with :
26
26
images : ysde/docker-grafana-backup-tool
27
27
28
+ - name : Extract metadata (tags, labels) for Docker (Slim version)
29
+ id : meta_slim
30
+ uses : docker/metadata-action@v4
31
+ with :
32
+ images : ysde/docker-grafana-backup-tool
33
+ flavor : |
34
+ latest=auto
35
+ suffix=-slim,onlatest=true
36
+
28
37
- name : Build and push Docker image
29
- uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
38
+ uses : docker/build-push-action@v4
30
39
with :
31
- context : .
32
40
push : true
33
41
tags : ${{ steps.meta.outputs.tags }}
34
42
labels : ${{ steps.meta.outputs.labels }}
43
+
44
+ - name : Build and push Docker image slim version
45
+ uses : docker/build-push-action@v4
46
+ with :
47
+ file : ./DockerfileSlim
48
+ push : true
49
+ tags : ${{ steps.meta_slim.outputs.tags }}
50
+ labels : ${{ steps.meta_slim.outputs.labels }}
Original file line number Diff line number Diff line change @@ -2,38 +2,20 @@ FROM alpine:latest
2
2
3
3
LABEL maintainer="ysde108@gmail.com"
4
4
5
- ARG UID=1337
6
- ARG GID=1337
7
5
ENV RESTORE false
8
6
ENV ARCHIVE_FILE ""
9
7
10
- ENV DEV_PACKAGES="\
11
- gcc \
12
- libc-dev \
13
- libffi-dev \
14
- py3-pip \
15
- python3-dev \
16
- "
8
+ RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
9
+ && apk --no-cache add python3-dev libffi-dev gcc libc-dev py3-pip py3-cffi py3-cryptography ca-certificates bash
17
10
18
- ENV PACKAGES="\
19
- bash \
20
- ca-certificates \
21
- py3-cffi \
22
- py3-cryptography \
23
- py3-six \
24
- "
25
11
WORKDIR /opt/grafana-backup-tool
26
12
ADD . /opt/grafana-backup-tool
27
13
28
14
RUN chmod -R a+r /opt/grafana-backup-tool \
29
15
&& find /opt/grafana-backup-tool -type d -print0 | xargs -0 chmod a+rx
30
16
31
- RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
32
- && apk add --no-cache --virtual build-deps ${DEV_PACKAGES} \
33
- && apk add --no-cache ${PACKAGES} \
34
- && pip3 --no-cache-dir install . \
35
- && chown -R ${UID}:${GID} /opt/grafana-backup-tool \
36
- && apk del build-deps
17
+ RUN pip3 --no-cache-dir install .
37
18
38
- USER ${UID}
19
+ RUN chown -R 1337:1337 /opt/grafana-backup-tool
20
+ USER 1337
39
21
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'
Original file line number Diff line number Diff line change
1
+ FROM alpine:latest
2
+
3
+ LABEL maintainer="ysde108@gmail.com"
4
+
5
+ ARG UID=1337
6
+ ARG GID=1337
7
+ ENV RESTORE false
8
+ ENV ARCHIVE_FILE ""
9
+
10
+ ENV DEV_PACKAGES="\
11
+ gcc \
12
+ libc-dev \
13
+ libffi-dev \
14
+ py3-pip \
15
+ python3-dev \
16
+ "
17
+
18
+ ENV PACKAGES="\
19
+ bash \
20
+ ca-certificates \
21
+ py3-cffi \
22
+ py3-cryptography \
23
+ py3-six \
24
+ "
25
+ WORKDIR /opt/grafana-backup-tool
26
+ ADD . /opt/grafana-backup-tool
27
+
28
+ RUN chmod -R a+r /opt/grafana-backup-tool \
29
+ && find /opt/grafana-backup-tool -type d -print0 | xargs -0 chmod a+rx
30
+
31
+ RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
32
+ && apk add --no-cache --virtual build-deps ${DEV_PACKAGES} \
33
+ && apk add --no-cache ${PACKAGES} \
34
+ && pip3 --no-cache-dir install . \
35
+ && chown -R ${UID}:${GID} /opt/grafana-backup-tool \
36
+ && apk del build-deps
37
+
38
+ USER ${UID}
39
+ 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'
You can’t perform that action at this time.
0 commit comments