Skip to content

Commit 2971024

Browse files
authored
Add Dockerfile (#2)
* 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
1 parent 68b410e commit 2971024

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed

.github/workflows/release.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: "Build and Push Docker image"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
release:
8+
types:
9+
- published
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
14+
concurrency:
15+
group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.ref }}
16+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref_type != 'tag' }}
17+
18+
jobs:
19+
build:
20+
name: Build ${{ matrix.name }} - ${{ matrix.label }}
21+
strategy:
22+
matrix:
23+
include:
24+
- name: GitHub Actions
25+
dockerfile: Dockerfile.gha
26+
label: ${{ github.repository_owner }}/temporal-gha-service
27+
- name: Official
28+
dockerfile: Dockerfile
29+
label: ${{ github.repository_owner }}/temporal-dev-server
30+
permissions:
31+
contents: read
32+
packages: write
33+
id-token: write
34+
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
# Install the cosign tool except on PR
40+
# https://github.com/sigstore/cosign-installer
41+
# - name: Install cosign
42+
# if: github.event_name != 'pull_request'
43+
# uses: sigstore/[email protected]
44+
# with:
45+
# cosign-release: "v2.1.1"
46+
47+
# Set up BuildKit Docker container builder to be able to build
48+
# multi-platform images and export cache
49+
# https://github.com/docker/setup-buildx-action
50+
- name: Set up Docker Buildx
51+
uses: docker/[email protected]
52+
with:
53+
install: true
54+
55+
# Login against a Docker registry except on PR
56+
# https://github.com/docker/login-action
57+
- name: Log into registry ${{ env.REGISTRY }}
58+
if: github.event_name != 'pull_request'
59+
uses: docker/[email protected]
60+
with:
61+
registry: ${{ env.REGISTRY }}
62+
username: ${{ github.actor }}
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
65+
# Extract metadata (tags, labels) for Docker
66+
# https://github.com/docker/metadata-action
67+
- name: Extract Docker metadata (${{ matrix.name }})
68+
id: meta
69+
uses: docker/[email protected]
70+
with:
71+
images: "${{ env.REGISTRY }}/${{ matrix.label }}"
72+
73+
# Build and push Docker image with Buildx (don't push on PR)
74+
# https://github.com/docker/build-push-action
75+
- name: Build and push Docker image (${{ matrix.name }})
76+
id: build-and-push
77+
uses: docker/[email protected]
78+
with:
79+
context: .
80+
file: ${{ matrix.dockerfile }}
81+
push: ${{ github.event_name != 'pull_request' }}
82+
tags: ${{ steps.meta.outputs.tags }}
83+
labels: ${{ steps.meta.outputs.labels }}
84+
cache-from: type=gha
85+
cache-to: type=gha,mode=max
86+
87+
# Sign the resulting Docker image digest except on PRs.
88+
# This will only write to the public Rekor transparency log when the Docker
89+
# repository is public to avoid leaking data. If you would like to publish
90+
# transparency data even for private images, pass --force to cosign below.
91+
# https://github.com/sigstore/cosign
92+
# - name: Sign the published Docker image
93+
# if: ${{ github.event_name != 'pull_request' }}
94+
# env:
95+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
96+
# COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
97+
# COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
98+
# DIGEST: ${{ steps.build-and-push.outputs.digest }}
99+
# TAGS: ${{ steps.meta.outputs.tags }}
100+
# This step uses the identity token to provision an ephemeral certificate
101+
# against the sigstore community Fulcio instance.
102+
# run: echo "${TAGS}" | xargs -I {} cosign sign --yes --key env://COSIGN_PRIVATE_KEY {}@${DIGEST}

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM temporalio/admin-tools:1.23
2+
EXPOSE 7233
3+
EXPOSE 8233
4+
ENTRYPOINT ["/usr/local/bin/temporal", "server", "start-dev", "-p", "7233", "--ip", "0.0.0.0"]

Dockerfile.gha

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM temporalio/admin-tools:1.23
2+
EXPOSE 7233
3+
ENTRYPOINT ["/usr/local/bin/temporal", "server", "start-dev", "-p", "7233", "--ip", "0.0.0.0"]
4+
CMD ["--namespace", "test"]

0 commit comments

Comments
 (0)