-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add github actions workflow, add land-server and land-worker d…
…ockerfiles
- Loading branch information
Showing
5 changed files
with
128 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
target/ | ||
.vscode/ | ||
assets/ | ||
data/ | ||
demo/ |
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,49 @@ | ||
name: Build Github Packages | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
tags: ["v*"] | ||
env: | ||
CARGO_TERM_COLOR: always | ||
concurrency: | ||
group: ghcr-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
dockerize: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- dockerfile: ./land-worker.Dockerfile | ||
image: ghcr.io/${{ github.repository_owner }}/runtime-land-worker | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ matrix.image }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Github Container Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ${{ matrix.dockerfile }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,19 @@ | ||
FROM rust:1.82 AS build | ||
|
||
WORKDIR /usr/src/land-server | ||
COPY . . | ||
RUN rustup component add rustfmt | ||
RUN bash /usr/src/land-server/scripts/land-server-deps.sh | ||
RUN cargo version | ||
RUN cargo build -p land-server --release | ||
|
||
FROM debian:stable-slim | ||
WORKDIR /opt/bin/ | ||
RUN \ | ||
apt-get update && \ | ||
apt-get install -y ca-certificates && \ | ||
apt-get clean | ||
COPY --from=build /usr/src/land-server/target/release/land-server /opt/bin/land-server | ||
COPY --from=build /usr/src/land-server/wizer-v6.0.0-x86_64-linux /opt/bin/wizer | ||
EXPOSE 9840 | ||
CMD ["/opt/bin/land-server","--verbose"] |
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,13 @@ | ||
FROM rust:1.82 as build | ||
|
||
WORKDIR /usr/src/land-src | ||
COPY . . | ||
RUN rustup component add rustfmt | ||
RUN cargo version | ||
RUN cargo build -p land-worker --release | ||
|
||
FROM debian:stable-slim | ||
WORKDIR /opt/bin/ | ||
COPY --from=build /usr/src/land-src/target/release/land-worker /opt/bin/land-worker | ||
EXPOSE 9940 | ||
CMD ["/opt/bin/land-worker","--verbose"] |
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,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Colors for output | ||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
NC='\033[0m' # No Color | ||
|
||
# Print in colors - 1=green, 2=red, other=neutral | ||
# e.g. log_print 0 "All is great" | ||
log_print() { | ||
if [[ $1 == 1 ]]; then | ||
echo -e "${GREEN}${2}${NC}" | ||
elif [[ $1 == 2 ]]; then | ||
echo -e "${RED}${2}${NC}" | ||
else | ||
echo -e "${2}" | ||
fi | ||
} | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
# Function used to check if utilities are available | ||
require() { | ||
if ! hash "$1" &>/dev/null; then | ||
log_print 2 "'$1' not found in PATH. This is required for this script to work." | ||
exit 1 | ||
fi | ||
} | ||
|
||
require curl | ||
require tar | ||
|
||
download_wizer_binary() { | ||
log_print 0 "Downloading wizer" | ||
local archive_url="https://github.com/bytecodealliance/wizer/releases/download/v7.0.5/wizer-v7.0.5-x86_64-linux.tar.xz" | ||
log_print 1 "Downloading wizer: $archive_url" | ||
curl --progress-bar --show-error --location --fail $archive_url --output "wizer-v7.0.5.tar.xz" | ||
tar -xvf "wizer-v7.0.5.tar.xz" | ||
} | ||
|
||
download_wizer_binary |