refactor: changed workflow to use Ubuntu

replaced dev container Dockerfile with one which uses
Ubuntu instead of Alpine. The Docker in Docker feature only
works on Ubuntu, not Debian or Alpine, and the LLDB extension
to enable debugging only supports Debian/Ubuntu
This commit is contained in:
Andrew Rioux 2023-05-06 21:43:19 -04:00
parent f3453f4399
commit f72aa6e98d
8 changed files with 94 additions and 41 deletions

View File

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

View File

@ -1,29 +0,0 @@
# Copyright (C) 2023 Andrew Rioux
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
FROM rust:1-buster
ENV DEBIAN_FRONTEND=noninteractive
#apk add musl-dev openssl-dev docker-compose lldb && \
RUN apt update && \
apt install -y git cmake make automake autoconf libtool valgrind flex \
linux-headers-5.10 bison docker-compose lldb libssl-dev libnl-3-dev sudo && \
rustup component add clippy && \
rustup target add x86_64-unknown-linux-musl && \
useradd vscode && \
mkdir -p /home/vscode && \
chown -R vscode:vscode /home/vscode && \
echo "vscode ALL=(ALL: ALL) NOPASSWD: ALL" >> /etc/sudoers

View File

@ -15,8 +15,5 @@
FROM rust:1-alpine FROM rust:1-alpine
RUN apk add bash docker git cmake make automake musl-dev autoconf libtool valgrind \ RUN apk add cmake make automake musl-dev autoconf libtool \
flex bison linux-headers openssl-dev apache2-utils docker-compose lldb && \ flex bison linux-headers openssl-dev lldb build-base
rustup component add clippy && \
mkdir /etc/docker && \
echo '{ "storage-driver": "vfs" }' > /etc/docker/daemon.json

View File

@ -0,0 +1,57 @@
# Copyright (C) 2023 Andrew Rioux
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
FROM ubuntu:22.04
ARG USERNAME=vscode
ENV DEBIAN_FRONTEND=noninteractive \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
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-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* && \
adduser ${USERNAME} && \
echo "$USERNAME ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chsh -s /usr/bin/zsh ${USERNAME} && \
wget https://static.rust-lang.org/rustup/archive/1.25.2/x86_64-unknown-linux-gnu/rustup-init && \
echo "bb31eaf643926b2ee9f4d8d6fc0e2835e03c0a60f34d324048aa194f0b29a71c *rustup-init" | sha256sum -c - && \
chmod +x rustup-init && \
./rustup-init -y --no-modify-path --profile minimal \
--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
USER vscode
RUN cargo install cargo-make
#FROM rust:1-buster
#
#ENV DEBIAN_FRONTEND=noninteractive
#
#apk add musl-dev openssl-dev docker-compose lldb && \
#RUN apt update && \
# apt install -y git cmake make automake autoconf libtool valgrind flex musl-tools \
# linux-headers-5.10 bison docker-compose lldb libssl-dev libnl-3-dev sudo && \
# rustup component add clippy && \
# rustup target add x86_64-unknown-linux-musl && \
# useradd vscode && \
# mkdir -p /home/vscode && \
# chown -R vscode:vscode /home/vscode && \
# echo "vscode ALL=(ALL: ALL) NOPASSWD: ALL" >> /etc/sudoers

View File

@ -1,7 +1,7 @@
{ {
"name": "sparse", "name": "sparse",
"build": { "build": {
"dockerfile": "Dockerfile" "dockerfile": "Dockerfile.buster"
}, },
"customizations": { "customizations": {
"vscode": { "vscode": {
@ -28,11 +28,9 @@
"--security-opt", "--security-opt",
"seccomp=unconfined" "seccomp=unconfined"
], ],
"postStartCommand": "git submodule update --init", "postStartCommand": "git submodule update --init && docker pull rust:1-alpine",
"remoteUser": "vscode", "remoteUser": "vscode",
"features": { "features": {
"ghcr.io/devcontainers/features/docker-in-docker": { "ghcr.io/devcontainers/features/docker-in-docker": {}
"dockerDashComposeVersion": "v2"
}
} }
} }

7
.vscode/launch.json vendored
View File

@ -102,5 +102,12 @@
"args": [], "args": [],
"cwd": "${workspaceFolder}" "cwd": "${workspaceFolder}"
}, },
{
"name": "test launch",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/ex-bind-shell-backdoor",
"args": []
}
] ]
} }

13
Makefile.toml Normal file
View File

@ -0,0 +1,13 @@
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
[config]
skip_core_tasks = true
[tasks.default]
dependencies = ["build"]
[tasks.build]
workspace = false
command = "docker-compose"
args = [ "run", "build", "${@}" ]

View File

@ -1,5 +1,15 @@
version: '3.8' version: '3.8'
services: services:
build:
build:
context: .devcontainer
dockerfile: Dockerfile.alpine
volumes:
- ${CARGO_HOME}/registry:${CARGO_HOME}/registry
- ${PWD}:/sparse
working_dir: /sparse
entrypoint: "/usr/local/cargo/bin/cargo build"
examples_bindshell_target: examples_bindshell_target:
build: build:
context: examples/secure-image context: examples/secure-image