Skip to content

Commit 5c368e2

Browse files
committed
add docker containerization and image push gha
1 parent be7c3e7 commit 5c368e2

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
target
2+
README.md
3+
Dockerfile
4+
target/CACHEDIR.TAG

.github/workflows/deploy-docker.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy Node Docker Image
2+
on:
3+
push:
4+
branches:
5+
'developer'
6+
7+
permissions:
8+
contents: read
9+
packages: write
10+
11+
jobs:
12+
Deploy:
13+
name: Deploy
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out Git repository
18+
uses: actions/checkout@v4
19+
20+
- name: Configure AWS Credentials
21+
uses: aws-actions/configure-aws-credentials@v2
22+
with:
23+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
24+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25+
aws-region: us-east-1
26+
27+
- name: Login to AWS Registry
28+
run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $AWS_REGISTRY_URL
29+
env:
30+
AWS_REGISTRY_URL: ${{ secrets.AWS_NODE_REGISTRY_URL }}
31+
32+
- name: Build Node Image
33+
run: docker build -t oreowallet .
34+
35+
- name: Deploy Node Image to AWS
36+
run: |
37+
docker tag oreowallet ${{ secrets.AWS_NODE_REGISTRY_URL }}/oreowallet:developer
38+
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/oreowallet:developer

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
.vscode
33
.env
4+
dbconfig.txt

Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Use the official Rust image as a base
2+
FROM rust:latest AS builder
3+
4+
# Set the working directory
5+
WORKDIR /app
6+
7+
# Copy the entire workspace
8+
COPY . .
9+
10+
# Build the project
11+
RUN cargo build --release
12+
13+
# Use a minimal base image for the final container
14+
FROM debian:bookworm-slim
15+
16+
RUN apt-get update && apt-get install -y \
17+
libssl3 \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
# Set the working directory
21+
WORKDIR /app
22+
23+
# Copy the built binaries from the builder stage
24+
COPY --from=builder /app/target/release/server /app/server
25+
COPY --from=builder /app/target/release/chain_loader /app/chain_loader
26+
COPY --from=builder /app/target/release/dservice /app/dservice
27+
COPY --from=builder /app/target/release/dworker /app/dworker
28+
COPY --from=builder /app/target/release/prover /app/prover
29+
30+
31+
# Expose necessary ports
32+
EXPOSE 10002 9093 10001 20001
33+
34+
# Define the entry point for the container
35+
CMD ["./main"]

0 commit comments

Comments
 (0)