Skip to content

Commit

Permalink
Build docker image with backup tools
Browse files Browse the repository at this point in the history
  • Loading branch information
afausti committed Dec 10, 2024
1 parent e0a1656 commit 44e6c41
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

"on":
merge_group: {}
pull_request: {}
push:
tags:
- "*"

jobs:

build:
runs-on: ubuntu-latest

# Only do Docker builds of tagged releases and pull requests from ticket
# branches.
if: >
startsWith(github.ref, 'refs/tags/')
|| startsWith(github.head_ref, 'tickets/')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: lsst-sqre/build-and-push-to-ghcr@v1
id: build
with:
image: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- run: echo Pushed ghcr.io/${{ github.repository }}:${{ steps.build.outputs.tag }}
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Start from the InfluxDB Enterprise Meta image
# This provides the InfluxDB Enterprise influxd-ctl command
FROM influxdb:1.11.8-meta

# Install pipx and use it to install gsutil which is required for the backup script
# to upload the backup files to Google Cloud Storage
RUN apt-get update && \
apt-get install -y python3 python3-pip pipx && \
pipx install gsutil && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Add pipx bin directory to PATH
ENV PATH="/root/.local/bin:$PATH"

# Verify gsutil installation
RUN gsutil --version

# Create a non-root user.
RUN useradd --create-home sasquatch

# Add the backup script
COPY backup/backup.sh /usr/local/bin/backup.sh
RUN chmod +x /usr/local/bin/backup.sh

# Switch to the non-root user.
USER sasquatch

# Set the default command for the container
CMD ["/usr/local/bin/backup.sh"]
1 change: 1 addition & 0 deletions backup/backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "backup"

0 comments on commit 44e6c41

Please sign in to comment.