Skip to content

Commit 758e551

Browse files
Merge pull request #18 from thebongy/feature/docker-publish
Feature/docker publish
2 parents 4fc7f73 + c1d3295 commit 758e551

File tree

4 files changed

+104
-1
lines changed

4 files changed

+104
-1
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target
2+
.dockerignore
3+
Dockerfile

.github/workflows/build.yml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ jobs:
6565
tagFormat: v${version}
6666
id: version_check
6767

68+
- name: Generate docker tags (ubuntu)
69+
uses: thebongy/version-check@v1
70+
with:
71+
file: Cargo.toml
72+
tagFormat: ${version}
73+
id: docker_tags_ubuntu
74+
75+
- name: Check docker tags (alpine)
76+
uses: thebongy/version-check@v1
77+
with:
78+
file: Cargo.toml
79+
tagFormat: ${version}-beta-alpine
80+
id: docker_tags_alpine
81+
6882
- name: Download Windows Artifact
6983
uses: actions/download-artifact@v1
7084
with:
@@ -88,6 +102,24 @@ jobs:
88102
mv release/windows/juno.exe release/windows/juno-${{steps.version_check.outputs.releaseVersion}}-windows.exe
89103
mv release/macos/juno release/macos/juno-${{steps.version_check.outputs.releaseVersion}}-macos
90104
mv release/linux/juno release/linux/juno-${{steps.version_check.outputs.releaseVersion}}-linux
105+
106+
- name: Publish ubuntu docker image
107+
uses: docker/build-push-action@v1
108+
with:
109+
username: ${{ secrets.DOCKER_USERNAME }}
110+
password: ${{ secrets.DOCKER_PASSWORD }}
111+
repository: bytesonus/juno
112+
tags: latest,${{ steps.docker_tags_ubuntu.outputs.releaseTags }}
113+
dockerfile: ./Dockerfile
114+
115+
- name: Publish alpine docker image
116+
uses: docker/build-push-action@v1
117+
with:
118+
username: ${{ secrets.DOCKER_USERNAME }}
119+
password: ${{ secrets.DOCKER_PASSWORD }}
120+
repository: bytesonus/juno
121+
tags: latest-alpine,${{ steps.docker_tags_alpine.outputs.rawVersion }}
122+
dockerfile: ./Dockerfile.alpine
91123

92124
- name: Publish Release
93125
uses: softprops/action-gh-release@v1
@@ -113,7 +145,21 @@ jobs:
113145
file: Cargo.toml
114146
tagFormat: v${version}-beta
115147
id: version_check
116-
148+
149+
- name: Generate docker tags (ubuntu)
150+
uses: thebongy/version-check@v1
151+
with:
152+
file: Cargo.toml
153+
tagFormat: ${version}-beta
154+
id: docker_tags_ubuntu
155+
156+
- name: Check docker tags (alpine)
157+
uses: thebongy/version-check@v1
158+
with:
159+
file: Cargo.toml
160+
tagFormat: ${version}-beta-alpine
161+
id: docker_tags_alpine
162+
117163
- name: Download Windows Artifact
118164
uses: actions/download-artifact@v1
119165
with:
@@ -137,6 +183,24 @@ jobs:
137183
mv release/windows/juno.exe release/windows/juno-${{steps.version_check.outputs.releaseVersion}}-windows.exe
138184
mv release/macos/juno release/macos/juno-${{steps.version_check.outputs.releaseVersion}}-macos
139185
mv release/linux/juno release/linux/juno-${{steps.version_check.outputs.releaseVersion}}-linux
186+
187+
- name: Publish ubuntu docker image
188+
uses: docker/build-push-action@v1
189+
with:
190+
username: ${{ secrets.DOCKER_USERNAME }}
191+
password: ${{ secrets.DOCKER_PASSWORD }}
192+
repository: bytesonus/juno
193+
tags: beta,${{ steps.docker_tags_ubuntu.outputs.releaseTags }}
194+
dockerfile: ./Dockerfile
195+
196+
- name: Publish alpine docker image
197+
uses: docker/build-push-action@v1
198+
with:
199+
username: ${{ secrets.DOCKER_USERNAME }}
200+
password: ${{ secrets.DOCKER_PASSWORD }}
201+
repository: bytesonus/juno
202+
tags: beta-alpine,${{ steps.docker_tags_alpine.outputs.releaseTags }}
203+
dockerfile: ./Dockerfile.alpine
140204

141205
- name: Publish Release
142206
uses: softprops/action-gh-release@v1

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM rust:latest as build
2+
3+
RUN rustup target add x86_64-unknown-linux-gnu
4+
5+
WORKDIR /usr/src/juno
6+
7+
COPY . .
8+
9+
RUN cargo build --release --target=x86_64-unknown-linux-gnu
10+
11+
FROM ubuntu:focal
12+
13+
WORKDIR /juno
14+
15+
COPY --from=build /usr/src/juno/target/x86_64-unknown-linux-gnu/release/juno .
16+
17+
CMD ["init", "--", "/juno/juno"]

Dockerfile.alpine

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM rust:latest as build
2+
3+
RUN rustup target add x86_64-unknown-linux-musl
4+
5+
WORKDIR /usr/src/juno
6+
7+
COPY . .
8+
9+
RUN cargo build --release --target=x86_64-unknown-linux-musl
10+
11+
FROM alpine:latest
12+
13+
WORKDIR /juno
14+
15+
COPY --from=build /usr/src/juno/target/x86_64-unknown-linux-musl/release/juno .
16+
17+
RUN apk add --no-cache dumb-init
18+
19+
CMD ["dumb-init", "--", "/juno/juno"]

0 commit comments

Comments
 (0)