-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Obmondo/repository-snapshot
Creating docker image for repositopry-snapshot
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- 'repository-snapshot/**' | ||
- '.github/workflows/repository-snapshot.yaml' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Generate container metadata | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ghcr.io/obmondo/dockerfiles/repository-snapshot | ||
tags: | | ||
type=semver,pattern={{version}},value=v1.0.0 | ||
flavor: | | ||
latest=false | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build & push container image | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./repository-mirror | ||
labels: ${{ steps.meta.outputs.labels }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} |
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,32 @@ | ||
# Use the specified base image | ||
FROM ubuntu:24.04 | ||
|
||
# Installing dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
coreutils \ | ||
curl \ | ||
createrepo-c \ | ||
cron \ | ||
debianutils \ | ||
wget \ | ||
rsync | ||
|
||
# Adding Enableit repo and key | ||
RUN wget https://repos.obmondo.com/packagesign/public/apt/pubkey.gpg -O /etc/apt/keyrings/obmondo_custom.asc | ||
RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/obmondo_custom.asc] https://repos.obmondo.com/packagesign/public/apt noble main" | tee -a /etc/apt/sources.list.d/obmondo_custom.list | ||
|
||
# Installing obmondo-scripts-common and obmondo-repository-mirror | ||
RUN apt-get update && apt-get install -y \ | ||
obmondo-scripts-common \ | ||
obmondo-repository-mirror | ||
|
||
# Create a crontab file for the scheduled job | ||
RUN echo "0 2 * * 0 /usr/local/bin/snapshot_repo >> /var/log/snapshot_repo.log 2>&1" > /etc/cron.d/snapshot_repo && \ | ||
chmod 0644 /etc/cron.d/snapshot_repo | ||
|
||
# Apply cron job and create log file | ||
RUN crontab /etc/cron.d/snapshot_repo && \ | ||
touch /var/log/snapshot_repo.log | ||
|
||
# Start the cron service | ||
CMD ["cron", "-f"] |