-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f61a27
commit 4c6ffd9
Showing
337 changed files
with
88 additions
and
52,987 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,52 @@ | ||
name: Docker Hub Deployment | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: pulling git repo | ||
uses: actions/checkout@v2 | ||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo- | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
- name: Build and test code | ||
run: | | ||
cargo build --verbose | ||
cargo test --verbose | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: true | ||
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/skylark:build-v1.001 | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "section_04" | ||
name = "logging" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
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,24 @@ | ||
FROM messense/rust-musl-cross:x86_64-musl as chef | ||
RUN cargo install cargo-chef | ||
WORKDIR /logging | ||
|
||
FROM chef AS planner | ||
# Copy source code from previous stage | ||
COPY . . | ||
# Generate info for caching dependencies | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
COPY --from=planner /logging/recipe.json recipe.json | ||
# Build & cache dependencies | ||
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json | ||
# Copy source code from previous stage | ||
COPY . . | ||
# Build application | ||
RUN cargo build --release --target x86_64-unknown-linux-musl | ||
|
||
# Create a new stage with a minimal image | ||
FROM scratch | ||
COPY --from=builder /logging/target/x86_64-unknown-linux-musl/release/logging /logging | ||
ENTRYPOINT ["/logging"] | ||
EXPOSE 80 |
Oops, something went wrong.