Skip to content

Commit 7631a98

Browse files
committed
Add docker support
1 parent b18d6a0 commit 7631a98

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

.github/workflows/docker-push.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ jobs:
1616

1717
name: Build Image
1818
runs-on: ubuntu-latest
19-
defaults:
20-
run:
21-
working-directory: solana-programs
2219
steps:
2320
- name: Check out code
2421
uses: actions/checkout@v2
@@ -86,5 +83,5 @@ jobs:
8683
IMAGE_TAG: ${{ env.VERSION }}
8784
run: |
8885
REGISTRY_ALIAS=$(aws ecr-public describe-registries | jq --raw-output .registries[0].registryId)
89-
docker build -t $ECR_REGISTRY/$REGISTRY_ALIAS/$ECR_REPOSITORY:$IMAGE_TAG $CONTAINER_PATH
86+
docker build -t $ECR_REGISTRY/$REGISTRY_ALIAS/$ECR_REPOSITORY:$IMAGE_TAG . -f $CONTAINER_PATH.Dockerfile
9087
docker push $ECR_REGISTRY/$REGISTRY_ALIAS/$ECR_REPOSITORY:$IMAGE_TAG

tuktuk-crank-turner.Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Build stage
2+
FROM rust:1.76-slim-bullseye as builder
3+
4+
# Install system dependencies and clean up in the same layer
5+
RUN apt-get update && \
6+
apt-get install -y --no-install-recommends \
7+
pkg-config \
8+
build-essential \
9+
libudev-dev \
10+
protobuf-compiler && \
11+
rm -rf /var/lib/apt/lists/* && \
12+
rm -rf /tmp/*
13+
14+
WORKDIR /app
15+
COPY . .
16+
17+
# Build with cleanup
18+
RUN cargo build --release --package tuktuk-crank-turner && \
19+
rm -rf /app/target/release/deps && \
20+
rm -rf /app/target/release/build && \
21+
rm -rf /usr/local/cargo/registry
22+
23+
# Runtime stage
24+
FROM debian:bullseye-slim
25+
26+
# Install runtime dependencies with minimal installation
27+
RUN apt-get update && \
28+
apt-get install -y --no-install-recommends \
29+
ca-certificates \
30+
libssl-dev && \
31+
rm -rf /var/lib/apt/lists/* && \
32+
rm -rf /tmp/*
33+
34+
WORKDIR /app
35+
36+
# Copy the binary from builder
37+
COPY --from=builder /app/target/release/tuktuk-crank-turner /usr/local/bin/
38+
39+
# Create directory for key file
40+
RUN mkdir -p /app/keys
41+
42+
ENTRYPOINT ["tuktuk-crank-turner"]

0 commit comments

Comments
 (0)