Skip to content

Commit

Permalink
Add Dockerfile (#2)
Browse files Browse the repository at this point in the history
* chore(#1): added Dockerfile

* chore(#1): matrix of 2 images one for GHA, other default for use in dev

* chore(#1): fix titles in GitHub actions definition

* chore(#1): fix global names
  • Loading branch information
snovak7 committed Jun 1, 2024
1 parent 68b410e commit 2971024
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: "Build and Push Docker image"

on:
pull_request:
branches:
- main
release:
types:
- published

env:
REGISTRY: ghcr.io

concurrency:
group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref_type != 'tag' }}

jobs:
build:
name: Build ${{ matrix.name }} - ${{ matrix.label }}
strategy:
matrix:
include:
- name: GitHub Actions
dockerfile: Dockerfile.gha
label: ${{ github.repository_owner }}/temporal-gha-service
- name: Official
dockerfile: Dockerfile
label: ${{ github.repository_owner }}/temporal-dev-server
permissions:
contents: read
packages: write
id-token: write

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
# - name: Install cosign
# if: github.event_name != 'pull_request'
# uses: sigstore/[email protected]
# with:
# cosign-release: "v2.1.1"

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
install: true

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata (${{ matrix.name }})
id: meta
uses: docker/[email protected]
with:
images: "${{ env.REGISTRY }}/${{ matrix.label }}"

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image (${{ matrix.name }})
id: build-and-push
uses: docker/[email protected]
with:
context: .
file: ${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# if: ${{ github.event_name != 'pull_request' }}
# env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
# COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
# COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
# DIGEST: ${{ steps.build-and-push.outputs.digest }}
# TAGS: ${{ steps.meta.outputs.tags }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
# run: echo "${TAGS}" | xargs -I {} cosign sign --yes --key env://COSIGN_PRIVATE_KEY {}@${DIGEST}
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM temporalio/admin-tools:1.23
EXPOSE 7233
EXPOSE 8233
ENTRYPOINT ["/usr/local/bin/temporal", "server", "start-dev", "-p", "7233", "--ip", "0.0.0.0"]
4 changes: 4 additions & 0 deletions Dockerfile.gha
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM temporalio/admin-tools:1.23
EXPOSE 7233
ENTRYPOINT ["/usr/local/bin/temporal", "server", "start-dev", "-p", "7233", "--ip", "0.0.0.0"]
CMD ["--namespace", "test"]

0 comments on commit 2971024

Please sign in to comment.