Skip to content

Commit

Permalink
add: download ipinfo db during docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
sstidl committed Jul 28, 2024
1 parent a53b4fe commit 01fc0d9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,33 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

# Fetch the ipinfo database file using curl if API key is defined
- name: Fetch DB from ipinfo.io
run: |
if [ -z "${{ secrets.IPINFO_APIKEY }}" ]; then
echo "Warning: API_KEY is not defined."
else
curl -L https://ipinfo.io/data/free/country_asn.mmdb?token=${{ secrets.IPINFO_APIKEY }} -o backend/country_asn.mmdb
fi
# Build the Docker image
- name: Build Docker image
run: |
docker build -t your-docker-image-name .
# Optionally push the Docker image to a registry
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push Docker image
run: |
docker tag your-docker-image-name your-dockerhub-username/your-docker-image-name:latest
docker push your-dockerhub-username/your-docker-image-name:latest
######################
# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
Expand Down

0 comments on commit 01fc0d9

Please sign in to comment.