-
Notifications
You must be signed in to change notification settings - Fork 9
Create Dockerfile #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Create Dockerfile #133
Changes from all commits
f5e065f
5ca42d6
ab2ad77
f792277
b44296a
2b366d5
388e577
efdb3a2
bec12bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Build and Push Docker Image to Docker Hub | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
workflow_dispatch: | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
set_env: | ||
name: Create version tag | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tags: ${{ steps.version_step.outputs.tags }} | ||
env: | ||
VERSION: ${{ github.ref_name }} | ||
SHA: ${{ github.sha }} | ||
steps: | ||
- id: version_step | ||
run: | | ||
set -Eeuo pipefail | ||
IFS=$'\n\t' | ||
|
||
if [[ "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-rc-[0-9]+)?$ ]]; then | ||
echo "Valid version: $VERSION" | ||
echo "tags=latest,$VERSION,$SHA" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "Invalid ref_name format: $VERSION" >&2 | ||
exit 1 | ||
fi | ||
|
||
build_push: | ||
uses: zcash/.github/.github/workflows/build-and-push-docker-hub.yaml@main | ||
needs: set_env | ||
with: | ||
image_name: zallet | ||
image_tags: ${{ needs.set_env.outputs.tags }} | ||
dockerfile: Dockerfile | ||
context: . | ||
build-args: "" | ||
secrets: | ||
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
dockerhub_registry: ${{ secrets.DOCKERHUB_REGISTRY }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build and Run Docker Container | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: main | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
build_and_run: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
with: | ||
persist-credentials: false | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker build -t zallet . | ||
|
||
- name: Run command inside Docker container | ||
run: | | ||
docker run --rm zallet -h | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI the problem you last commit was fixing is that you tried to use In general, |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# --- Stage 1: Build with Rust --- (amd64) | ||
FROM rust:1-slim@sha256:57d415bbd61ce11e2d5f73de068103c7bd9f3188dc132c97cef4a8f62989e944 AS builder | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
clang \ | ||
libclang-dev \ | ||
pkg-config \ | ||
git && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . . | ||
|
||
RUN cargo build --release && strip target/release/zallet | ||
|
||
# --- Stage 2: Minimal runtime with distroless --- | ||
FROM gcr.io/distroless/cc | ||
|
||
COPY --from=builder /app/target/release/zallet /usr/local/bin/zallet | ||
|
||
USER nonroot | ||
ENTRYPOINT ["/usr/local/bin/zallet"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing? It looks recursive to me which makes no sense. Is this actually pulling from the
zcash/zcash
repo?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the template we're using in Zcash and across several of our other repositories. - Just realized I missed updating a path — just fixed it now.