Skip to content

Commit 63083cd

Browse files
committed
feat: add Docker image build with dockers_v2 and multi-arch support
1 parent 34eed2d commit 63083cd

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ jobs:
3838
# on your needs.
3939
- name: Configure git for private modules
4040
run: git config --global url."https://speakeasybot:${{ secrets.BOT_REPO_TOKEN }}@github.com".insteadOf "https://github.com"
41+
- name: Login to GitHub Container Registry
42+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.BOT_REPO_TOKEN }}
4147
- name: Setup Choco
4248
uses: crazy-max/ghaction-chocolatey@2526f467ccbd337d307fe179959cabbeca0bc8c0 # v3.4.0
4349
with:

.goreleaser.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ builds:
1515
- linux
1616
- windows
1717
- darwin
18+
goarch:
19+
- amd64
20+
- arm64
21+
ignore:
22+
- goos: windows
23+
goarch: arm64 # Windows ARM64 can be enabled if needed
1824
ldflags:
1925
- "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser -X main.artifactArch={{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
2026
archives:
@@ -32,6 +38,26 @@ changelog:
3238
exclude:
3339
- "^docs:"
3440
- "^test:"
41+
42+
dockers_v2:
43+
- id: speakeasy
44+
dockerfile: Dockerfile
45+
ids: [speakeasy]
46+
images:
47+
- ghcr.io/speakeasy-api/speakeasy
48+
tags:
49+
- "{{ .Tag }}"
50+
- "latest"
51+
platforms:
52+
- linux/amd64
53+
- linux/arm64
54+
labels:
55+
org.opencontainers.image.title: "{{ .ProjectName }}"
56+
org.opencontainers.image.version: "{{ .Version }}"
57+
org.opencontainers.image.revision: "{{ .Commit }}"
58+
org.opencontainers.image.source: "{{ .GitURL }}"
59+
org.opencontainers.image.created: "{{ .Date }}"
60+
3561
brews:
3662
- name: speakeasy
3763
repository:

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM debian:12-slim
2+
3+
# Install only sudo (required by Speakeasy CLI)
4+
RUN apt-get update && \
5+
apt-get install -y --no-install-recommends \
6+
sudo \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
# Create a non-root user with sudo access
10+
RUN groupadd -g 1001 speakeasy && \
11+
useradd -u 1001 -g speakeasy -m -s /bin/bash speakeasy && \
12+
echo 'speakeasy ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
13+
14+
USER speakeasy
15+
16+
# Copy the binary from GoReleaser build context
17+
# GoReleaser will automatically use the correct binary for the target architecture
18+
COPY speakeasy /usr/local/bin/speakeasy
19+
20+
# Make the binary executable
21+
RUN chmod +x /usr/local/bin/speakeasy
22+
23+
# Default entrypoint
24+
ENTRYPOINT ["speakeasy"]
25+
CMD ["--version"]

0 commit comments

Comments
 (0)