Skip to content

Commit a167779

Browse files
committed
Added dockerfile and workflow to push to dockerhub
1 parent 0a14df0 commit a167779

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
@@ -233,6 +233,36 @@ jobs:
233233
name: artifacts
234234
path: dist-manifest.json
235235

236+
publish-to-dockerhub:
237+
runs-on: ubuntu-latest
238+
needs: [plan, should-publish]
239+
steps:
240+
- uses: actions/checkout@v4
241+
with:
242+
submodules: recursive
243+
- name: Login to Docker Hub
244+
uses: docker/login-action@v3
245+
with:
246+
username: ${{ secrets.DOCKERHUB_USERNAME }}
247+
password: ${{ secrets.DOCKERHUB_TOKEN }}
248+
- name: "Build and push docker image"
249+
run: |
250+
docker build . -t leptos/cargo-leptos:latest -t leptos/cargo-leptos:stable;
251+
docker push leptos/cargo-leptos:latest;
252+
docker push leptos/cargo-leptos:stable;
253+
254+
tag="";
255+
for i in $(echo ${{ needs.plan.outputs.tag }} | tr '.' '\n')
256+
do
257+
if [[ $tag == "" ]]; then
258+
tag="$i";
259+
else
260+
tag="$tag.$i";
261+
fi
262+
docker tag leptos/cargo-leptos:latest leptos/cargo-leptos:$tag;
263+
docker push leptos/cargo-leptos:$tag;
264+
done
265+
236266
# Create a Github Release while uploading all files to it
237267
announce:
238268
needs:

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)