Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbb8f83

Browse files
authored
feat: build & release cross-platform Docker images (#1178)
* feat: add dockerfile and docker-compose* build docker images on release* add Docker dependencies to release.yaml* remove docker compose for now* fix license mismatch* add docker-compose* rename volume* add WF dispatch for debugging
1 parent7b5300d commitbbb8f83

File tree

4 files changed

+111
-11
lines changed

4 files changed

+111
-11
lines changed

‎.github/workflows/release.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,32 @@ on:
33
push:
44
tags:
55
-"v*"
6+
workflow_dispatch:
7+
68
jobs:
79
goreleaser:
810
runs-on:macos-latest
11+
env:
12+
# Necessary for Docker manifest
13+
DOCKER_CLI_EXPERIMENTAL:"enabled"
914
steps:
15+
# Docker is not included on macos-latest
16+
-uses:docker-practice/actions-setup-docker@v1
17+
1018
-uses:actions/checkout@v3
1119
with:
1220
fetch-depth:0
21+
22+
-name:Set up QEMU
23+
uses:docker/setup-qemu-action@v1
24+
25+
-name:Docker Login
26+
uses:docker/login-action@v1
27+
with:
28+
registry:ghcr.io
29+
username:${{ github.repository_owner }}
30+
password:${{ secrets.GITHUB_TOKEN }}
31+
1332
-uses:actions/setup-go@v3
1433
with:
1534
go-version:"~1.18"

‎.goreleaser.yaml

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,17 @@ before:
2828
builds:
2929
-id:coder-slim
3030
dir:cmd/coder
31-
ldflags:
32-
["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
31+
ldflags:["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
3332
env:[CGO_ENABLED=0]
3433
goos:[darwin, linux, windows]
3534
goarch:[amd64, arm, arm64]
3635
goarm:["7"]
3736
# Only build arm 7 for Linux
3837
ignore:
3938
-goos:windows
40-
goarm:'7'
39+
goarm:"7"
4140
-goos:darwin
42-
goarm:'7'
41+
goarm:"7"
4342
hooks:
4443
# The "trimprefix" appends ".exe" on Windows.
4544
post:|
@@ -48,8 +47,7 @@ builds:
4847
-id:coder-linux
4948
dir:cmd/coder
5049
flags:[-tags=embed]
51-
ldflags:
52-
["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
50+
ldflags:["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
5351
env:[CGO_ENABLED=0]
5452
goos:[linux]
5553
goarch:[amd64, arm, arm64]
@@ -58,24 +56,22 @@ builds:
5856
-id:coder-windows
5957
dir:cmd/coder
6058
flags:[-tags=embed]
61-
ldflags:
62-
["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
59+
ldflags:["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
6360
env:[CGO_ENABLED=0]
6461
goos:[windows]
6562
goarch:[amd64, arm64]
6663

6764
-id:coder-darwin
6865
dir:cmd/coder
6966
flags:[-tags=embed]
70-
ldflags:
71-
["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
67+
ldflags:["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
7268
env:[CGO_ENABLED=0]
7369
goos:[darwin]
7470
goarch:[amd64, arm64]
7571
hooks:
7672
# This signs the binary that will be located inside the zip.
7773
# MacOS requires the binary to be signed for notarization.
78-
#
74+
#
7975
# If it doesn't successfully sign, the zip sign step will error.
8076
post:|
8177
sh -c 'codesign -s {{.Env.AC_APPLICATION_IDENTITY}} -f -v --timestamp --options runtime {{.Path}} || true'
@@ -107,6 +103,54 @@ nfpms:
107103
-src:coder.service
108104
dst:/usr/lib/systemd/system/coder.service
109105

106+
dockers:
107+
-image_templates:["ghcr.io/coder/coder:{{ .Tag }}-amd64"]
108+
id:coder-linux
109+
dockerfile:Dockerfile
110+
use:buildx
111+
build_flag_templates:
112+
---platform=linux/amd64
113+
---label=org.opencontainers.image.title=Coder
114+
---label=org.opencontainers.image.description=A tool for provisioning self-hosted development environments with Terraform.
115+
---label=org.opencontainers.image.url=https://github.com/coder/coder
116+
---label=org.opencontainers.image.source=https://github.com/coder/coder
117+
---label=org.opencontainers.image.version={{ .Version }}
118+
---label=org.opencontainers.image.revision={{ .FullCommit }}
119+
---label=org.opencontainers.image.licenses=AGPL-3.0
120+
-image_templates:["ghcr.io/coder/coder:{{ .Tag }}-arm64"]
121+
goarch:arm64
122+
dockerfile:Dockerfile
123+
use:buildx
124+
build_flag_templates:
125+
---platform=linux/arm64/v8
126+
---label=org.opencontainers.image.title=coder
127+
---label=org.opencontainers.image.description=A tool for provisioning self-hosted development environments with Terraform.
128+
---label=org.opencontainers.image.url=https://github.com/coder/coder
129+
---label=org.opencontainers.image.source=https://github.com/coder/coder
130+
---label=org.opencontainers.image.version={{ .Tag }}
131+
---label=org.opencontainers.image.revision={{ .FullCommit }}
132+
---label=org.opencontainers.image.licenses=AGPL-3.0
133+
-image_templates:["ghcr.io/coder/coder:{{ .Tag }}-armv7"]
134+
goarch:arm
135+
goarm:"7"
136+
dockerfile:Dockerfile
137+
use:buildx
138+
build_flag_templates:
139+
---platform=linux/arm/v7
140+
---label=org.opencontainers.image.title=Coder
141+
---label=org.opencontainers.image.description=A tool for provisioning self-hosted development environments with Terraform.
142+
---label=org.opencontainers.image.url=https://github.com/coder/coder
143+
---label=org.opencontainers.image.source=https://github.com/coder/coder
144+
---label=org.opencontainers.image.version={{ .Tag }}
145+
---label=org.opencontainers.image.revision={{ .FullCommit }}
146+
---label=org.opencontainers.image.licenses=AGPL-3.0
147+
docker_manifests:
148+
-name_template:ghcr.io/coder/coder:{{ .Tag }}
149+
image_templates:
150+
-ghcr.io/coder/coder:{{ .Tag }}-amd64
151+
-ghcr.io/coder/coder:{{ .Tag }}-arm64
152+
-ghcr.io/coder/coder:{{ .Tag }}-armv7
153+
110154
release:
111155
ids:[coder-linux, coder-darwin, coder-windows, packages]
112156

‎Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM alpine
2+
3+
# Generated by goreleaser on `goreleaser release`
4+
ADD coder /opt/coder
5+
6+
ENTRYPOINT ["/opt/coder","server" ]

‎docker-compose.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version:"3.9"
2+
services:
3+
coder:
4+
image:ghcr.io/coder/coder:v${CODER_VERSION:-0.5.5}-${ARCH:-amd64}
5+
ports:
6+
-"7080:7080"
7+
environment:
8+
CODER_PG_CONNECTION_URL:"postgresql://username:password@database/coder?sslmode=disable"
9+
CODER_ADDRESS:"0.0.0.0:7080"
10+
depends_on:
11+
database:
12+
condition:service_healthy
13+
database:
14+
image:"postgres:14.2"
15+
environment:
16+
POSTGRES_USER:${POSTGRES_USER:-username}# The PostgreSQL user (useful to connect to the database)
17+
POSTGRES_PASSWORD:${POSTGRES_PASSWORD:-password}# The PostgreSQL password (useful to connect to the database)
18+
POSTGRES_DB:${POSTGRES_DB:-coder}# The PostgreSQL default database (automatically created at first launch)
19+
volumes:
20+
-coder_data:/var/lib/postgresql/data# Use "docker volume rm coder_coder_data" to reset Coder
21+
healthcheck:
22+
test:
23+
[
24+
"CMD-SHELL",
25+
"pg_isready -U ${POSTGRES_USER:-username} -d ${POSTGRES_DB:-coder}",
26+
]
27+
interval:5s
28+
timeout:5s
29+
retries:5
30+
volumes:
31+
coder_data:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp