Compare commits

..

4 commits

7 changed files with 64 additions and 0 deletions

3
.gitignore vendored
View file

@ -20,3 +20,6 @@ Cargo.lock
# and can be added to the global gitignore or merged into this file. For a more nuclear # and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
# Result
build/*

28
docker/build/Dockerfile Normal file
View file

@ -0,0 +1,28 @@
## BACKEND ##
# Parent image
FROM debian
# Creating directories
RUN mkdir /work /src /app
WORKDIR /work
# Installing Deps
RUN apt update -y
RUN apt install -y wget build-essential libssl-dev pkg-config
# Downloading Rust Install Script
RUN wget https://sh.rustup.rs -O /tmp/rust.sh
RUN chmod +x /tmp/rust.sh
# Installing Rust Toolchain
RUN /tmp/rust.sh -y
# Getting Environment Variable
ENV PROJ_NAME=example
# Copying Build Script
COPY docker/build/build.sh /bin/build.sh
RUN chmod +x /bin/build.sh
## RUNTILE ##
CMD ["bash", "/bin/build.sh"]

8
docker/build/build.sh Normal file
View file

@ -0,0 +1,8 @@
# Copying source code to working directory
cp -r /src/* .
# Building the app
/root/.cargo/bin/cargo build
# Copying app to Result Directory
cp target/debug/$PROJ_NAME /app/$PROJ_NAME

6
project/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "example"
version = "0.1.0"
edition = "2021"
[dependencies]

3
project/src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

9
scripts/build/build.sh Executable file
View file

@ -0,0 +1,9 @@
# Clearing The Screen
clear
# Building the Rust App
docker run --rm -it \
-v "$PWD/project:/src:Z" \
-v "$PWD/build:/app:Z" \
-e "PROJ_NAME=example" \
rust-buildbot $@

7
scripts/build/docker.sh Executable file
View file

@ -0,0 +1,7 @@
# Clearing The Screen
clear
# Building the Docker Container
docker build . \
-t rust-buildbot \
-f docker/build/Dockerfile