Skip to content

Commit 1fd2266

Browse files
committed
try Docker build workflow
Signed-off-by: Kingdon Barrett <[email protected]>
1 parent 8954364 commit 1fd2266

File tree

3 files changed

+70
-27
lines changed

3 files changed

+70
-27
lines changed

.github/workflows/deploy.yml

+56-26
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,51 @@ jobs:
6363
uses: fermyon/actions/spin/setup@v1
6464

6565
# Push: WASM
66-
- name: Push to OCI
67-
id: push
68-
uses: fermyon/actions/spin/push@v1
66+
# - name: Push to OCI
67+
# id: push
68+
# uses: fermyon/actions/spin/push@v1
69+
# with:
70+
# registry: ghcr.io
71+
# registry_username: ${{ github.actor }}
72+
# registry_password: ${{ secrets.GITHUB_TOKEN }}
73+
# registry_reference: "ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-2"
74+
# manifest_file: spin.toml
75+
76+
# Push: Docker WASM (alternate while spin registry push cannot be used)
77+
- name: Set up QEMU
78+
uses: docker/setup-qemu-action@v3
79+
- name: setup buildx
80+
uses: docker/setup-buildx-action@v3
81+
- name: login to GitHub container registry
82+
uses: docker/login-action@v3
6983
with:
7084
registry: ghcr.io
71-
registry_username: ${{ github.actor }}
72-
registry_password: ${{ secrets.GITHUB_TOKEN }}
73-
registry_reference: "ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-2"
74-
manifest_file: spin.toml
85+
username: ${{ github.actor }}
86+
password: ${{ secrets.GITHUB_TOKEN }}
7587

76-
# Deploy:
77-
- name: Deploy to Fermyon Cloud
78-
uses: fermyon/actions/spin/deploy@v1
88+
- name: enable containerd image store
89+
run: |
90+
echo '{ "features": { "containerd-snapshotter": true } }' | sudo tee /etc/docker/daemon.json
91+
sudo systemctl restart docker
92+
93+
# Copied from https://github.com/spinkube/containerd-shim-spin/blob/main/.github/workflows/docker-build-push.yaml
94+
- name: build and push
95+
uses: docker/build-push-action@v5
7996
with:
80-
fermyon_token: ${{ secrets.FERMYON_CLOUD_TOKEN }}
81-
run_build: false
97+
push: true
98+
tags: |
99+
ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-3
100+
ghcr.io/kingdon-ci/flux-docs/build:latest
101+
context: .
102+
platforms: wasi/wasm
103+
provenance: false
104+
105+
# Deploy:
106+
# - name: Deploy to Fermyon Cloud
107+
# uses: fermyon/actions/spin/deploy@v1
108+
# with:
109+
# fermyon_token: ${{ secrets.FERMYON_CLOUD_TOKEN }}
110+
# run_build: false
82111

83112
- name: Set up Flux CLI
84113
uses: fluxcd/flux2/[email protected]
@@ -87,16 +116,23 @@ jobs:
87116
- name: Set Image (Kustomize SpinApp)
88117
run: |
89118
pushd deploy/spin-app
90-
kustomize edit set image flux-docs/build=ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-2
119+
kustomize edit set image flux-docs/build=ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-3
91120
popd
92121
93122
# Login: GHCR
94-
- name: Login to GitHub Container Registry
95-
uses: docker/login-action@v3
96-
with:
97-
registry: ghcr.io
98-
username: ${{ github.actor }}
99-
password: ${{ secrets.GITHUB_TOKEN }}
123+
#(Moved up to Docker build action while spin registry push is not viable for us)
124+
# - name: Login to GitHub Container Registry
125+
# uses: docker/login-action@v3
126+
# with:
127+
# registry: ghcr.io
128+
# username: ${{ github.actor }}
129+
# password: ${{ secrets.GITHUB_TOKEN }}
130+
131+
- name: Install cosign
132+
uses: sigstore/[email protected]
133+
134+
- name: Cosign version
135+
run: cosign version
100136

101137
# Push: Kubernetes (Flux App)
102138
- name: Push manifests
@@ -108,12 +144,6 @@ jobs:
108144
--revision="${{ github.ref_name }}@sha1:${{ github.sha }}" \
109145
--annotations='org.opencontainers.image.description=Fluxcd.io website SpinKube manifests'
110146
111-
- name: Install cosign
112-
uses: sigstore/[email protected]
113-
114-
- name: Cosign version
115-
run: cosign version
116-
117147
# Sign: Kubernetes manifests
118148
- name: Sign OCI YAML manifests
119149
run: |
@@ -124,4 +154,4 @@ jobs:
124154
- name: Sign OCI WASM artifact
125155
run: |
126156
# keyless mode
127-
cosign sign ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-2 -y
157+
cosign sign ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-3 -y

Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# FROM --platform=${BUILDPLATFORM}
2+
FROM --platform=linux/arm64 golang:1.21.3-bullseye AS build-go
3+
WORKDIR /opt/build
4+
COPY spin.toml .
5+
RUN curl -LO https://github.com/fermyon/spin-fileserver/releases/download/v0.2.1/spin_static_fs.wasm
6+
RUN mkdir website
7+
COPY website/public/ website/public/
8+
9+
FROM scratch
10+
COPY --from=build-go /opt/build/spin_static_fs.wasm .
11+
COPY --from=build-go /opt/build/spin.toml .
12+
COPY --from=build-go /opt/build/website .

spin.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ route = "/..."
1212
component = "docs"
1313

1414
[component.docs]
15-
source = { url = "https://github.com/fermyon/spin-fileserver/releases/download/v0.2.1/spin_static_fs.wasm", digest = "sha256:5f05b15f0f7cd353d390bc5ebffec7fe25c6a6d7a05b9366c86dcb1a346e9f0f" }
15+
# source = { url = "https://github.com/fermyon/spin-fileserver/releases/download/v0.2.1/spin_static_fs.wasm", digest = "sha256:5f05b15f0f7cd353d390bc5ebffec7fe25c6a6d7a05b9366c86dcb1a346e9f0f" }
16+
source = "spin_static_fs.wasm"
1617
files = [{ source = "website/public", destination = "/" }]

0 commit comments

Comments
 (0)