Skip to content

Commit

Permalink
refactor docker (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik authored Oct 19, 2023
1 parent 26de433 commit 6c7ba6e
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 234 deletions.
62 changes: 6 additions & 56 deletions .github/workflows/dev-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,62 +34,12 @@ jobs:
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"

- name: Build (optionally publish) PeerDB Dev Image
uses: depot/build-push-action@v1
- name: Build (optionally publish) PeerDB Images
uses: depot/bake-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
platforms: linux/amd64,linux/arm64
context: .
file: stacks/peerdb-server.Dockerfile
files: ./docker-bake.hcl
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/peerdb-io/peerdb-server:dev-${{ steps.vars.outputs.sha_short }}
ghcr.io/peerdb-io/peerdb-server:latest-dev
- name: Build (optionally publish) Flow API Dev Image
uses: depot/build-push-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
platforms: linux/amd64,linux/arm64
context: .
file: stacks/flow-api.Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/peerdb-io/flow-api:dev-${{ steps.vars.outputs.sha_short }}
ghcr.io/peerdb-io/flow-api:latest-dev
- name: Build (optionally publish) Flow Worker Dev Image
uses: depot/build-push-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
platforms: linux/amd64,linux/arm64
context: .
file: stacks/flow-worker.Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/peerdb-io/flow-worker:dev-${{ steps.vars.outputs.sha_short }}
ghcr.io/peerdb-io/flow-worker:latest-dev
- name: Build (optionally publish) Flow Snapshot Worker Dev Image
uses: depot/build-push-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
platforms: linux/amd64,linux/arm64
context: .
file: stacks/flow-snapshot-worker.Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/peerdb-io/flow-snapshot-worker:dev-${{ steps.vars.outputs.sha_short }}
ghcr.io/peerdb-io/flow-snapshot-worker:latest-dev
- name: Build (optionally publish) PeerDB UI Dev Image
uses: depot/build-push-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
platforms: linux/amd64,linux/arm64
context: .
file: stacks/peerdb-ui.Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/peerdb-io/peerdb-ui:dev-${{ steps.vars.outputs.sha_short }}
ghcr.io/peerdb-io/peerdb-ui:latest-dev
env:
SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
TAG: latest-dev
62 changes: 6 additions & 56 deletions .github/workflows/stable-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,62 +29,12 @@ jobs:
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: Publish PeerDB Stable Image
uses: depot/build-push-action@v1
- name: Build (optionally publish) PeerDB Images
uses: depot/bake-action@v1
with:
platforms: linux/amd64,linux/arm64
token: ${{ secrets.DEPOT_TOKEN }}
context: .
file: stacks/peerdb-server.Dockerfile
push: true
tags: |
ghcr.io/peerdb-io/peerdb-server:${{ github.ref_name }}
ghcr.io/peerdb-io/peerdb-server:latest-stable
- name: Publish Flow API Image
uses: depot/build-push-action@v1
with:
platforms: linux/amd64,linux/arm64
token: ${{ secrets.DEPOT_TOKEN }}
context: .
file: stacks/flow-api.Dockerfile
push: true
tags: |
ghcr.io/peerdb-io/flow-api:${{ github.ref_name }}
ghcr.io/peerdb-io/flow-api:latest-stable
- name: Publish Flow Worker Stable Image
uses: depot/build-push-action@v1
with:
platforms: linux/amd64,linux/arm64
token: ${{ secrets.DEPOT_TOKEN }}
context: .
file: stacks/flow-worker.Dockerfile
push: true
tags: |
ghcr.io/peerdb-io/flow-worker:${{ github.ref_name }}
ghcr.io/peerdb-io/flow-worker:latest-stable
- name: Publish Flow Snapshot Worker Stable Image
uses: depot/build-push-action@v1
with:
platforms: linux/amd64,linux/arm64
token: ${{ secrets.DEPOT_TOKEN }}
context: .
file: stacks/flow-snapshot-worker.Dockerfile
push: true
tags: |
ghcr.io/peerdb-io/flow-snapshot-worker:${{ github.ref_name }}
ghcr.io/peerdb-io/flow-snapshot-worker:latest-stable
- name: Build (optionally publish) PeerDB UI Stable Image
uses: depot/build-push-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
platforms: linux/amd64,linux/arm64
context: .
file: stacks/peerdb-ui.Dockerfile
files: ./docker-bake.hcl
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/peerdb-io/peerdb-ui:${{ github.ref_name }}
ghcr.io/peerdb-io/peerdb-ui:latest-stable
env:
SHA_SHORT: ${{ github.ref_name }}
TAG: latest-stable
89 changes: 89 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
variable SHA_SHORT {
default = "123456"
}

variable TAG {
default = "latest-dev"
}

variable REGISTRY {
default = "ghcr.io/peerdb-io"
}

group "default" {
targets = [
"peerdb",
"flow-worker",
"flow-api",
"flow-snapshot-worker",
"peerdb-ui"
]
}

target "flow-api" {
context = "."
dockerfile = "stacks/flow.Dockerfile"
target = "flow-api"
platforms = [
"linux/amd64",
"linux/arm64",
]
tags = [
"${REGISTRY}/flow-api:${TAG}",
"${REGISTRY}/flow-api:${SHA_SHORT}",
]
}

target "flow-snapshot-worker" {
context = "."
dockerfile = "stacks/flow.Dockerfile"
target = "flow-snapshot-worker"
platforms = [
"linux/amd64",
"linux/arm64",
]
tags = [
"${REGISTRY}/flow-snapshot-worker:${TAG}",
"${REGISTRY}/flow-snapshot-worker:${SHA_SHORT}",
]
}

target "flow-worker" {
context = "."
dockerfile = "stacks/flow.Dockerfile"
target = "flow-worker"
platforms = [
"linux/amd64",
"linux/arm64",
]
tags = [
"${REGISTRY}/flow-worker:${TAG}",
"${REGISTRY}/flow-worker:${SHA_SHORT}",
]
}

target "peerdb" {
context = "."
dockerfile = "stacks/peerdb-server.Dockerfile"
platforms = [
"linux/amd64",
"linux/arm64",
]
tags = [
"${REGISTRY}/peerdb-server:${TAG}",
"${REGISTRY}/peerdb-server:${SHA_SHORT}",
]
}

target "peerdb-ui" {
context = "."
dockerfile = "stacks/peerdb-ui.Dockerfile"
platforms = [
"linux/amd64",
"linux/arm64",
]
tags = [
"${REGISTRY}/peerdb-ui:${TAG}",
"${REGISTRY}/peerdb-ui:${SHA_SHORT}",
]
}
9 changes: 6 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ services:
container_name: flow_api
build:
context: .
dockerfile: stacks/flow-api.Dockerfile
dockerfile: stacks/flow.Dockerfile
target: flow-api
ports:
- 8112:8112
- 8113:8113
Expand All @@ -121,7 +122,8 @@ services:
container_name: flow-snapshot-worker
build:
context: .
dockerfile: stacks/flow-snapshot-worker.Dockerfile
dockerfile: stacks/flow.Dockerfile
target: flow-snapshot-worker
environment:
<<: [*peerdb-temporal-namespace]
TEMPORAL_HOST_PORT: temporal:7233
Expand All @@ -133,7 +135,8 @@ services:
container_name: flow-worker1
build:
context: .
dockerfile: stacks/flow-worker.Dockerfile
dockerfile: stacks/flow.Dockerfile
target: flow-worker
environment:
<<: [*catalog-config, *flow-worker-env, *peerdb-temporal-namespace]
METRICS_SERVER: 0.0.0.0:6061
Expand Down
45 changes: 0 additions & 45 deletions stacks/flow-api.Dockerfile

This file was deleted.

37 changes: 0 additions & 37 deletions stacks/flow-snapshot-worker.Dockerfile

This file was deleted.

37 changes: 0 additions & 37 deletions stacks/flow-worker.Dockerfile

This file was deleted.

Loading

0 comments on commit 6c7ba6e

Please sign in to comment.