Skip to content

Commit 78b9746

Browse files
committed
chore: Add docker deploy for workflows
1 parent 0c990b6 commit 78b9746

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

.github/workflows/cd.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,29 @@ jobs:
6060
include: LICENSE,README.md,huly-coder.yaml
6161
tar: all
6262
zip: windows
63-
token: ${{ secrets.GITHUB_TOKEN }}
63+
token: ${{ secrets.GITHUB_TOKEN }}
64+
upload-docker:
65+
name: Build & Push Docker Image
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Checkout repository
69+
uses: actions/checkout@v4
70+
71+
- name: Set up Docker Buildx
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Login to Docker Hub
75+
uses: docker/login-action@v3
76+
with:
77+
username: ${{ secrets.DOCKER_USER }}
78+
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
79+
80+
- run: echo VERSION=$(grep '^version =' Cargo.toml | cut -d '"' -f 2) >> $GITHUB_ENV
81+
82+
- name: Build and Push
83+
uses: docker/build-push-action@v6
84+
with:
85+
file: Dockerfile
86+
push: true
87+
tags: "${{ secrets.DOCKER_USER }}/huly-coder:${{ env.VERSION }},${{ secrets.DOCKER_USER }}/huly-coder:latest"
88+
platforms: linux/amd64,linux/arm64

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Build stage
2-
FROM rust:1.86 AS builder
2+
FROM --platform=$BUILDPLATFORM rust:1.86 AS builder
3+
ARG TARGETPLATFORM
34
WORKDIR /usr/src/huly-coder
45
COPY . .
56
RUN cargo build --release

0 commit comments

Comments
 (0)