Skip to content

Commit

Permalink
draft: building inside the container
Browse files Browse the repository at this point in the history
  • Loading branch information
dcdgo committed Mar 5, 2021
1 parent f82073e commit 66d8a69
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 26 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/Rust_part/target/
/Rust_part/tests/
/Rust_part/libvec.a
/RUst_part/Cargo.lock
C_part/.xmake/
C_part/build/
C_part/test/
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# designed for linux build
FROM rust:1.50

#install tools
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y musl-tools && \
rustup target add x86_64-unknown-linux-musl

RUN apt-get install software-properties-common -y
RUN apt-get install python3 -y
RUN apt-get install python-pip -y
RUN pip install --upgrade pip
RUN pip install conan

#install xmake
WORKDIR /usr/
RUN add-apt-repository ppa:xmake-io/xmake
RUN apt update
RUN apt install xmake

# set environment variables
ENV conanpath /usr/.conan/data/
ENV releasebuild true

# copy C source and Rust source
COPY ./Rust_part/ /usr/vectorizer/Rust_part/
COPY ./C_part/ /usr/vectorizer/C_part/

# initialize conan
WORKDIR /usr/vectorizer/C_part/build/
RUN conan install ..

#initialize xmake and build
WORKDIR /usr/vectorizer/C_part/
RUN xmake f -m release && \
xmake

#build Rust code
WORKDIR /usr/vectorizer/Rust_part/
RUN cargo build --release

#create entrypoint of container
CMD ["./target/release/trampoline"]
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ The rust part builds to `/discord-v/target/debug/`.

Commands to use the bot:
### Vectorize: Goes through all attachments of the command message, executes the algorithm on them and returns the output
`!v/!vectorize` with an attachment or url eg.
`!v or !vectorize` with an attachment or url eg.

!v https://cdn.discordapp.com/attachments/787470274261549056/807847299752394773/ginormous.png

Expand All @@ -119,7 +119,7 @@ Threshold is a number between 0 and 441.67 (The square root of 255^2 * 3 (vector
- A Threshold of 0 means any color that is not EXACTLY the same will be considered separate
- A threshold of 441.67 means the only color values considered different are rgb(0,0,0) and rgb(255,255,255) (white and black)

`!p/!params [chunksize] [threshold]` eg.
`!vp or !vectorizerparams [chunksize] [threshold]` eg.

!params 2 50
You should receive a confirmation message telling you what you set the parameters to
Expand All @@ -129,9 +129,10 @@ Currently only values of 0 and 1 are supported
- Value 0 means linked-list aggregation algorithm
- Value 1 means image-sweep algorithm

`!algo/!set_algorithm [algorithm_num]` eg.
`!va or !vectorizeralgorithm [algorithm_num]` eg.

!algo 0
!algo 0

You should receive a confirmation message telling you which algorithm number you set it to

# Package manager
Expand Down
15 changes: 0 additions & 15 deletions Rust_part/Dockerfile

This file was deleted.

7 changes: 0 additions & 7 deletions Rust_part/azurescript.txt

This file was deleted.

0 comments on commit 66d8a69

Please sign in to comment.