Skip to content

Commit

Permalink
Add backup
Browse files Browse the repository at this point in the history
  • Loading branch information
zhulik committed Nov 24, 2022
1 parent 3fe5c2c commit 170d80d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/update_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
- name: telegraf
repo: influxdata/telegraf
suffix: "alpine"
strategy: "check-upstream"

- name: backup
suffix: "alpine"
strategy: "always"


steps:
Expand All @@ -25,12 +30,14 @@ jobs:

- name: Get lates release for ${{ matrix.image.telegraf }}
id: last_release
if: "${{ matrix.strategy == 'check-upstream' }}"
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ matrix.image.repo }}

- name: Save latest version
id: last_version
if: "${{ matrix.strategy == 'check-upstream' }}"
run: |
echo "Latest release: ${{ steps.last_release.outputs.release }}"
version=$(echo ${{ steps.last_release.outputs.release }} | sed 's/^v\(.*\)/\1/') # Remove v from vX.Y.Z
Expand All @@ -39,6 +46,7 @@ jobs:
- name: Check if image is already built
id: exists
if: "${{ matrix.strategy == 'check-upstream' }}"
continue-on-error: true # We need to handle exit status
env:
TAG: "${{ steps.last_version.outputs.version }}-${{ matrix.image.suffix }}"
Expand All @@ -48,7 +56,7 @@ jobs:
echo "code=$?" >> $GITHUB_OUTPUT
- name: Build and publish to ghcr.io
if: ${{ steps.exists.outputs.code != 0 }}
if: ${{ steps.exists.outputs.code != 0 || matrix.strategy == 'always' }}
uses: macbre/push-to-ghcr@master
env:
TAG: "${{ steps.last_version.outputs.version }}-${{ matrix.image.suffix }}"
Expand Down
23 changes: 23 additions & 0 deletions backup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM alpine:3.17 as base

RUN mkdir /workdir
WORKDIR /workdir

RUN apk add --no-cache ruby ruby-dev &&\
gem install bundler &&\
bundle config set --local path './vendor'

ADD Gemfile ./

FROM base as builder

RUN apk add --no-cache alpine-sdk &&\
bundle install


FROM base

RUN apk add --no-cache postgresql15-client

COPY --from=builder /workdir/Gemfile.lock .
COPY --from=builder /workdir/vendor/ ./vendor/
3 changes: 3 additions & 0 deletions backup/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'rustic'

0 comments on commit 170d80d

Please sign in to comment.