Skip to content

Commit

Permalink
feat: docker
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5ea000000 authored and Tranduy1dol committed Oct 23, 2024
1 parent 7c8776f commit c001ae8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
17 changes: 16 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Ignore target directory
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Ignore version control files
Expand All @@ -10,26 +13,38 @@ target/
.idea/
*.swp
*.swo
# These are backup files generated by rustfmt
**/*.rs.bk

# Ignore log files
*.log
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# TODO : uncomment this
# Ignore any local environment files
# .env
# *.env
# IDEA config files
.idea

# Ignore any test or documentation directories
tests/
docs/
# Vscode config files
.vscode

# Ignore Rust-specific files
Cargo.lock
# Environment variables
#.env*

# Ignore any temporary files
*.tmp
*.bak

# Ignore OS-specific files
.DS_Store
Thumbs.db
Thumbs.db
# Log files
stderr.log
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ RUN python3.9 --version && pip3.9 --version
# Copy the current directory contents into the container
COPY . .


RUN cp -r /usr/local/rustup /rustup
RUN --mount=type=cache,target=/usr/local/rustup cp -r /rustup /usr/local && rm -r /rustup
RUN cp -r /usr/local/cargo /cargo
RUN --mount=type=cache,target=/usr/local/cargo cp -r /cargo /usr/local && rm -r /cargo

RUN --mount=type=cache,target=/usr/local/rustup \
--mount=type=cache,target=/usr/local/cargo \
--mount=type=cache,target=$HOME/app/target \
cargo build --release && cp $HOME/app/target/release/orchestrator ./orchestrator
# Check rust version (this also installs version from rust-toolchain file)
RUN rustup show

Expand Down Expand Up @@ -72,6 +80,7 @@ RUN apt-get -y update && \
# Set the working directory
WORKDIR /usr/local/bin

COPY --from=builder home/root/app/orchestrator ./
# Copy the compiled binary from the builder stage
COPY --from=builder /usr/src/madara-orchestrator/target/release/orchestrator .

Expand Down

0 comments on commit c001ae8

Please sign in to comment.