Skip to content

Commit

Permalink
Merge pull request #9 from Rerbun/main
Browse files Browse the repository at this point in the history
Added docker-compose and pipeline file and updated README to explain …
  • Loading branch information
alexplesoiu authored Mar 27, 2024
2 parents c9679de + 6ad265a commit c94d5da
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docker Build And Push

on:
push:
branches:
- 'main'

jobs:
docker:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ docker run -d --name dns-updater -v /path/to/local/main.py:/app/main.py --restar

This will run the container in detached mode and ensure it starts automatically when the server restarts, unless you explicitly stop it.

### Docker Compose
You could also use docker-compose to build the project, with a local image or by pulling an external image. (modify to docker-compose.yml if you want to pull from an external image). The script in the container will use the environment variables.
To build and run the image as a container run `docker compose up` (or `docker compose up -d` to run it detached as a background process).

## Tutorial
### 🔑 How to create and get an API Token from Cloudflare
1. Log in to your Cloudflare account.
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
dns-updater:
# Uncomment this to use an image instead of building locally
# image: your-image-tag
# Uncomment this to build locally
build: .
env_file:
- .env

0 comments on commit c94d5da

Please sign in to comment.