Skip to content

Commit 970dbbd

Browse files
committed
Added dockerfile and workflow to push to dockerhub
1 parent aff27c0 commit 970dbbd

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

.github/workflows/release.yml

+30
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,36 @@ jobs:
180180
- name: print tag
181181
run: echo "ok we're publishing!"
182182

183+
publish-to-dockerhub:
184+
runs-on: ubuntu-latest
185+
needs: [plan, should-publish]
186+
steps:
187+
- uses: actions/checkout@v4
188+
with:
189+
submodules: recursive
190+
- name: Login to Docker Hub
191+
uses: docker/login-action@v3
192+
with:
193+
username: ${{ secrets.DOCKERHUB_USERNAME }}
194+
password: ${{ secrets.DOCKERHUB_TOKEN }}
195+
- name: "Build and push docker image"
196+
run: |
197+
docker build . -t leptos/cargo-leptos:latest -t leptos/cargo-leptos:stable;
198+
docker push leptos/cargo-leptos:latest;
199+
docker push leptos/cargo-leptos:stable;
200+
201+
tag="";
202+
for i in $(echo ${{ needs.plan.outputs.tag }} | tr '.' '\n')
203+
do
204+
if [[ $tag == "" ]]; then
205+
tag="$i";
206+
else
207+
tag="$tag.$i";
208+
fi
209+
docker tag leptos/cargo-leptos:latest leptos/cargo-leptos:$tag;
210+
docker push leptos/cargo-leptos:$tag;
211+
done
212+
183213
# Create a Github Release with all the results once everything is done
184214
publish-release:
185215
needs: [plan, should-publish]

Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM --platform=amd64 rust:1.71 as build
2+
3+
RUN cargo install cargo-leptos
4+
5+
FROM --platform=amd64 rust:1.71
6+
7+
COPY --from=build /usr/local/cargo/bin/cargo-leptos /usr/local/cargo/bin/cargo-leptos
8+
9+
ENTRYPOINT ["cargo-leptos"]

0 commit comments

Comments
 (0)