build: adding to Cargo make config

Adding default tasks and setup task to run when container is made
This commit is contained in:
Andrew Rioux 2023-05-06 22:34:23 -04:00
parent c984b9eb56
commit 3257dfced0
5 changed files with 26 additions and 7 deletions

View File

@ -1,2 +0,0 @@
#[build]
#target = "x86_64-unknown-linux-musl"

View File

@ -23,7 +23,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
PATH=/usr/local/cargo/bin:$PATH:/home/vscode/.cargo/bin
RUN apt-get update && \
apt install -y git libtool valgrind docker-compose lldb sudo zsh wget && \
apt install -y cmake git libtool valgrind docker-compose lldb sudo zsh wget && \
apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* && \
adduser ${USERNAME} && \
echo "$USERNAME ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers && \
@ -35,8 +35,9 @@ RUN apt-get update && \
--default-toolchain nightly --default-host x86_64-unknown-linux-gnu \
--component rustfmt --component rust-src --component clippy && \
rm rustup-init && \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME
chmod -R a+w $RUSTUP_HOME $CARGO_HOME && \
echo "alias make='cargo make'" >> /etc/profile
USER vscode
RUN cargo install cargo-make
RUN cargo install cargo-make convco

View File

@ -28,7 +28,7 @@
"--security-opt",
"seccomp=unconfined"
],
"postStartCommand": "git submodule update --init && docker pull rust:1-alpine",
"postStartCommand": "cargo make setup",
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker": {}

View File

@ -10,4 +10,23 @@ dependencies = ["build"]
[tasks.build]
workspace = false
command = "docker-compose"
args = [ "run", "build", "${@}" ]
args = ["run", "build", "${@}"]
[tasks.fmt]
command = "cargo"
args = ["fmt"]
#----------------------------------
#
# Project setup tasks
#
#----------------------------------
[tasks.setup]
dependencies = ["pull-rust-image", "update-submodules"]
[tasks.pull-rust-image]
shell = "docker pull rust:1-alpine"
[tasks.update-submodules]
shell = "git submodule update --init"

View File

@ -9,6 +9,7 @@ services:
- ${PWD}:/sparse
working_dir: /sparse
entrypoint: "/usr/local/cargo/bin/cargo build"
tty: true
examples_bindshell_target:
build: