Skip to content

Commit

Permalink
Add Containerfile and GitHub workflow (#5)
Browse files Browse the repository at this point in the history
* Add basic Containerfile

* Add basic GitHub workflow to check that code builds successfully
  • Loading branch information
aleasims authored Oct 22, 2024
1 parent a00ad8a commit 04ec09e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build code

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
tags:
- "*"

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: redhat-actions/buildah-build@v2
with:
image: gvltctl
containerfiles: ./Containerfile
41 changes: 41 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Use the official Rust image as the build environment
FROM rust:1.82-bullseye as builder

RUN apt-get update && apt-get install -y \
protobuf-compiler curl \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sSL "https://github.com/bufbuild/buf/releases/download/v1.0.0/buf-Linux-x86_64" -o /usr/local/bin/buf
RUN chmod +x /usr/local/bin/buf

RUN USER=root cargo new --bin /gvltctl

WORKDIR /gvltctl

COPY Cargo.toml .
COPY Cargo.lock .

# pre-build dependencies
RUN cargo build --release

# Copy the source code and build script
COPY src ./src
COPY build.rs .

# Build the project
RUN cargo build --release && cp target/release/gvltctl /gvltctl-bin

# Use a minimal base image for the final stage
FROM debian:bullseye-slim

# Install necessary dependencies
RUN apt-get update && apt-get install -y \
libssl1.1 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Copy the compiled binary from the builder stage
COPY --from=builder /gvltctl-bin /usr/local/bin/gvltctl

# Set the entrypoint
ENTRYPOINT ["/usr/local/bin/gvltctl"]

0 comments on commit 04ec09e

Please sign in to comment.