Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit 381578a

Browse files
authored
Merge pull request neptyneco#4 from neptyneco/build-docker
Add docker build
2 parents 90c818c + 3fee5c3 commit 381578a

File tree

2 files changed

+84
-12
lines changed

2 files changed

+84
-12
lines changed

.github/workflows/docker.yml

+83-11
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,97 @@ on:
55
branches:
66
- master
77

8+
env:
9+
REGISTRY_IMAGE: neptyne/neptyne
10+
811
jobs:
9-
docker:
12+
build:
1013
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
platform:
18+
- linux/amd64
19+
- linux/arm64
1120
steps:
12-
-
13-
name: Set up QEMU
21+
- name: Prepare
22+
run: |
23+
platform=${{ matrix.platform }}
24+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
25+
26+
- name: Docker meta
27+
id: meta
28+
uses: docker/metadata-action@v5
29+
with:
30+
images: ${{ env.REGISTRY_IMAGE }}
31+
32+
- name: Set up QEMU
1433
uses: docker/setup-qemu-action@v3
15-
-
16-
name: Set up Docker Buildx
34+
35+
- name: Set up Docker Buildx
1736
uses: docker/setup-buildx-action@v3
18-
-
19-
name: Login to Docker Hub
37+
38+
- name: Login to Docker Hub
2039
uses: docker/login-action@v3
2140
with:
2241
username: ${{ secrets.DOCKERHUB_USERNAME }}
2342
password: ${{ secrets.DOCKERHUB_TOKEN }}
24-
-
25-
name: Build and push
43+
44+
- name: Build and push by digest
45+
id: build
2646
uses: docker/build-push-action@v6
2747
with:
28-
push: true
29-
tags: neptyne/neptyne:latest
48+
platforms: ${{ matrix.platform }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
51+
52+
- name: Export digest
53+
run: |
54+
mkdir -p /tmp/digests
55+
digest="${{ steps.build.outputs.digest }}"
56+
touch "/tmp/digests/${digest#sha256:}"
57+
58+
- name: Upload digest
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: digests-${{ env.PLATFORM_PAIR }}
62+
path: /tmp/digests/*
63+
if-no-files-found: error
64+
retention-days: 1
65+
66+
merge:
67+
runs-on: ubuntu-latest
68+
needs:
69+
- build
70+
steps:
71+
- name: Download digests
72+
uses: actions/download-artifact@v4
73+
with:
74+
path: /tmp/digests
75+
pattern: digests-*
76+
merge-multiple: true
77+
78+
- name: Set up Docker Buildx
79+
uses: docker/setup-buildx-action@v3
80+
81+
- name: Docker meta
82+
id: meta
83+
uses: docker/metadata-action@v5
84+
with:
85+
images: ${{ env.REGISTRY_IMAGE }}
86+
87+
- name: Login to Docker Hub
88+
uses: docker/login-action@v3
89+
with:
90+
username: ${{ secrets.DOCKERHUB_USERNAME }}
91+
password: ${{ secrets.DOCKERHUB_TOKEN }}
92+
93+
- name: Create manifest list and push
94+
working-directory: /tmp/digests
95+
run: |
96+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
97+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
98+
99+
- name: Inspect image
100+
run: |
101+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN /root/.cargo/bin/uv pip install --no-cache -r requirements.txt
2020
FROM node:16 AS frontend
2121
WORKDIR /app
2222
COPY frontend/package.json frontend/yarn.lock ./frontend/
23-
RUN cd frontend && yarn install
23+
RUN cd frontend && yarn install --network-timeout 500000
2424
COPY frontend ./frontend
2525
RUN cd frontend && yarn build
2626

0 commit comments

Comments
 (0)