Skip to content

Commit

Permalink
add docker containerization and image push gha
Browse files Browse the repository at this point in the history
  • Loading branch information
jowparks committed Oct 4, 2024
1 parent be7c3e7 commit 5c368e2
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target
README.md
Dockerfile
target/CACHEDIR.TAG
38 changes: 38 additions & 0 deletions .github/workflows/deploy-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy Node Docker Image
on:
push:
branches:
'developer'

permissions:
contents: read
packages: write

jobs:
Deploy:
name: Deploy
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to AWS Registry
run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $AWS_REGISTRY_URL
env:
AWS_REGISTRY_URL: ${{ secrets.AWS_NODE_REGISTRY_URL }}

- name: Build Node Image
run: docker build -t oreowallet .

- name: Deploy Node Image to AWS
run: |
docker tag oreowallet ${{ secrets.AWS_NODE_REGISTRY_URL }}/oreowallet:developer
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/oreowallet:developer
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
.vscode
.env
dbconfig.txt
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Use the official Rust image as a base
FROM rust:latest AS builder

# Set the working directory
WORKDIR /app

# Copy the entire workspace
COPY . .

# Build the project
RUN cargo build --release

# Use a minimal base image for the final container
FROM debian:bookworm-slim

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

# Set the working directory
WORKDIR /app

# Copy the built binaries from the builder stage
COPY --from=builder /app/target/release/server /app/server
COPY --from=builder /app/target/release/chain_loader /app/chain_loader
COPY --from=builder /app/target/release/dservice /app/dservice
COPY --from=builder /app/target/release/dworker /app/dworker
COPY --from=builder /app/target/release/prover /app/prover


# Expose necessary ports
EXPOSE 10002 9093 10001 20001

# Define the entry point for the container
CMD ["./main"]

0 comments on commit 5c368e2

Please sign in to comment.