Skip to content

Commit

Permalink
Merge pull request #1529 from CounterpartyXCP/docker
Browse files Browse the repository at this point in the history
Build and publish Docker image
  • Loading branch information
adamkrellenstein authored Mar 18, 2024
2 parents 0065ea2 + 0fb4ea7 commit efa4cce
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build Docker Image

on:
push:
branches: "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Docker
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
- name: Build image
run: |
docker build -t counterparty .
- name: Test image
run: |
docker run --rm counterparty counterparty-server -h
28 changes: 28 additions & 0 deletions .github/workflows/publish_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish Docker Image

on:
release:
types: [published]

env:
DOCKER_REPO: counterparty/counterparty
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Docker
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
- name: Build, tag, login and push image
run: |
export VERSION=v$(cat counterparty-lib/counterpartylib/lib/config.py | grep '__version__ =' | awk -F '"' '{print $2}')
docker build -t $DOCKER_REPO:$VERSION .
docker tag $DOCKER_REPO:$VERSION $DOCKER_REPO:latest
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
docker push $DOCKER_REPO:$VERSION
docker push $DOCKER_REPO:latest

0 comments on commit efa4cce

Please sign in to comment.