Skip to content

Commit

Permalink
try to debug github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
slackspace-io committed Mar 21, 2024
1 parent 6b2a3b1 commit 372b168
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:

- name: Log in to GitHub Container Registry
run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}

- name: list files in rust
run: ls -la ./rust
- name: Build and push
uses: docker/build-push-action@v2
with:
Expand Down
38 changes: 14 additions & 24 deletions rust/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
# STAGE1: Build the binary
# Use the official Rust image as a builder stage
FROM rust:alpine as builder

# Install build dependencies
RUN apk add --no-cache build-base musl-dev openssl-dev openssl

RUN apk add --no-cache musl-dev
RUN apk add --no-cache openssl-dev
# Create a new empty shell project
WORKDIR /app

# Copy over the Cargo.toml files to the shell project
COPY Cargo.toml Cargo.lock ./

# Build and cache the dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo fetch
WORKDIR app
COPY . .
# Copy our manifests
# Build only the dependencies to cache them
RUN cargo build --release
RUN rm src/main.rs
RUN rm src/*.rs

# Copy the actual code files and build the application
COPY src ./src/
# Update the file date
RUN touch src/main.rs
RUN cargo build --release
RUN touch src/main.rs && cargo build --release

# STAGE2: create a slim image with the compiled binary
FROM alpine as runner
# Use the official Debian Buster Slim image for the runtime stage
FROM alpine:latest

# Copy the binary from the builder stage
WORKDIR /app
COPY --from=builder /app/target/release/app app
COPY --from=builder /app/target/release/rust-slackwatch .

CMD ["./app"]
# Set the CMD to your binary
CMD ["./rust-slackwatch"]

0 comments on commit 372b168

Please sign in to comment.