-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub Actions builds docker image. (#580)
* Build Docker image with GitHub Actions. * Install clang, libclang-dev, and cmake. * Only run release workflows on tag. * Add Dockerfile in .editorconfig. * Fix typo. * Fix indentation of Dockerfile. * simplify: rust setup Co-authored-by: Xavier Lau <[email protected]> Co-authored-by: HackFisher <[email protected]>
- Loading branch information
1 parent
251bebc
commit ca06562
Showing
3 changed files
with
68 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,7 @@ indent_style=space | |
indent_size=2 | ||
indent_style=space | ||
tab_width=8 | ||
|
||
[Dockerfile*] | ||
indent_size=4 | ||
indent_style=space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: ["*"] | ||
|
||
jobs: | ||
build-docker-image: | ||
name: Build Docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: itering/actions | ||
path: .github/actions | ||
persist-credentials: false | ||
ssh-key: "${{ secrets.ITERING_ACTIONS_DEPLOY_KEY }}" | ||
|
||
- name: Docker login | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.QUAY_IO_BOT_USERNAME }} | ||
password: ${{ secrets.QUAY_IO_BOT_PASSWORD }} | ||
registry: quay.io | ||
|
||
- uses: ./.github/actions/docker-build-deploy | ||
with: | ||
deploy_phase: production | ||
docker_registry: quay.io | ||
trigger_token: ${{ secrets.ITERING_DEPLOYMENT_TRIGGER_TOKEN }} | ||
trigger_endpoint: ${{ secrets.ITERING_DEPLOYMENT_TRIGGER_ENDPOINT }} | ||
docker_build_options: -f .maintain/docker/Dockerfile | ||
skip_deploy: true # for now | ||
|
||
- uses: ./.github/actions/dingtalk-notify | ||
if: failure() && (github.event_name == 'pull_request' && github.event.pull_request.draft == false || github.event_name != 'pull_request') | ||
with: | ||
dingtalk_bot_token: ${{ secrets.DINGTALK_BOT_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
FROM iteringops/darwinia-builder:latest as builder | ||
## | ||
# Builder | ||
## | ||
|
||
RUN rustup update && rustup default nightly | ||
FROM rust:1 as builder | ||
|
||
COPY . /source | ||
WORKDIR /source | ||
ARG RUST_TOOLCHAIN=nightly-2020-10-06 | ||
ENV CARGO_TERM_COLOR=always | ||
|
||
ENV TERM="xterm-256color" | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
clang \ | ||
libclang-dev \ | ||
cmake \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN rustup default ${RUST_TOOLCHAIN} \ | ||
&& rustup target add wasm32-unknown-unknown | ||
|
||
WORKDIR /src | ||
COPY . . | ||
|
||
RUN cargo build --release | ||
|
||
## | ||
# Final stage | ||
## | ||
|
||
FROM debian:stable-slim | ||
|
||
RUN apt-get update && apt-get -y install openssl && apt-get clean | ||
COPY --from=builder /source/target/release/darwinia /usr/local/bin/. | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
openssl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /src/target/release/darwinia /usr/local/bin/ | ||
|
||
EXPOSE 30333 9933 9944 | ||
VOLUME ["/data"] | ||
|
||
ENTRYPOINT [ "/usr/local/bin/darwinia" ] |