-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build the basic release docker image (#232)
* Builds the basic release docker image. * Replaces the wrong target `aarch64-unknown-linux-gnu` with `x86_64-unknown-linux-gnu`. * Tests for the CI lint. * Updates for RUSTFLAGS.
- Loading branch information
1 parent
c232063
commit 2521a30
Showing
5 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,6 @@ | ||
FROM ubuntu:20.04 | ||
|
||
COPY config /config | ||
COPY target/x86_64-unknown-linux-gnu/release/matchengine /usr/bin/ | ||
|
||
CMD 'matchengine' |
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,40 @@ | ||
#!/bin/bash | ||
set -u | ||
|
||
if [ $# -ne 2 ] | ||
then | ||
echo "Usage: $0 docker-registry image-tag" | ||
exit 1 | ||
fi | ||
|
||
DOCKER_IMAGE_NAME='dingir-exchange-matchengine' | ||
DOCKER_TARGET="$1/$DOCKER_IMAGE_NAME:$2" | ||
|
||
function run() { | ||
install_cross | ||
build_release | ||
docker_build | ||
help_info | ||
} | ||
|
||
function install_cross() { | ||
echo 'install cross - https://github.com/rust-embedded/cross' | ||
cargo install cross | ||
} | ||
|
||
function build_release() { | ||
echo 'build a release for target x86_64-unknown-linux-gnu' | ||
RUSTFLAGS="-C link-arg=-static -C target-feature=+crt-static" cross build --bin matchengine --target x86_64-unknown-linux-gnu --release | ||
} | ||
|
||
function docker_build() { | ||
echo "docker build a image $DOCKER_TARGET" | ||
docker build -t $DOCKER_TARGET -f release/Dockerfile . | ||
} | ||
|
||
function help_info() { | ||
echo "Push to Docker Registry: docker push $DOCKER_TARGET" | ||
echo "Run a new Docker Container: docker run $DOCKER_TARGET" | ||
} | ||
|
||
run |