Skip to content

Commit

Permalink
improve DevContainer configuration, support socks5 proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
icecoobe committed Dec 24, 2024
1 parent e962087 commit 55d24b6
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 107 deletions.
97 changes: 97 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# https://docs.docker.com/reference/dockerfile/#overview
# https://docs.docker.com/build/building/best-practices/

FROM ubuntu:22.04

LABEL Name=oslab \
Version=0.0.1

ENV HOSTNAME=docker-oslab

RUN apt-get -y update && apt install -y \
build-essential \
bison \
flex \
libgmp3-dev \
libmpc-dev \
libmpfr-dev \
texinfo \
libisl-dev \
wget \
make \
libncurses-dev \
xorg-dev \
glew-utils \
unzip \
x11-utils \
x11-common \
qemu-system-i386 \
nasm \
git \
gdb \
dos2unix \
netcat-traditional \
binutils \
gcc

# RUN wget https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.xz
# RUN wget https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz
# RUN wget https://github.com/bochs-emu/Bochs/archive/refs/tags/REL_2_8_FINAL.zip

# RUN tar -xf binutils-2.43.tar.xz
# RUN tar -xf gcc-14.2.0.tar.xz

# RUN mkdir build-binutils && \
# cd build-binutils && \
# ../binutils-2.43/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror &&\
# make && \
# make install

# RUN mkdir build-gcc && \
# cd build-gcc && \
# ../gcc-14.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers --disable-multilib && \
# make all-gcc && \
# make all-target-libgcc && \
# make install-gcc && \
# make install-target-libgcc

RUN wget https://github.com/bochs-emu/Bochs/archive/refs/tags/REL_2_8_FINAL.zip && \
unzip REL_2_8_FINAL.zip -d /tmp && \
rm -rf REL_2_8_FINAL.zip

# Comment these lines, cause unzip doesn't support reading from stdin.
# while busybox unzip does
# ## The single '-' in wget means write to stdout
# ## The single '-' in unzip means read from stdin
# ## /bin/sh doesn't support pipefail
# SHELL ["/bin/bash", "-c"]
# RUN set -o pipefail && \
# wget --quiet -O - https://github.com/bochs-emu/Bochs/archive/refs/tags/REL_2_8_FINAL.zip | \
# unzip - -d /tmp

WORKDIR /tmp/Bochs-REL_2_8_FINAL/bochs

RUN ./configure \
--build=x86_64 \
--host=x86_64 \
--target=x86_64 \
--enable-cpu-level=6 \
--enable-pci \
--enable-gdb-stub \
--enable-logging \
--enable-fpu \
--enable-sb16=dummy \
--enable-cdrom \
--enable-x86-debugger \
--enable-iodebug \
--disable-docbook \
--with-x11

RUN make && make install

# if we don't change the workdir, we cannot remove /tmp/Bochs-REL_2_8_FINAL
WORKDIR /
RUN rm -rf /tmp/Bochs-REL_2_8_FINAL

CMD ["/bin/bash", "-c"]
# CMD ["sh", "-c", "/usr/games/fortune -a | cowsay"]
111 changes: 58 additions & 53 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,58 @@
// // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
// {
// "name": "Ubuntu",
// // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/base:jammy",
// "features": {
// "ghcr.io/devcontainers/features/git-lfs:1": {},
// "ghcr.io/cirolosapio/devcontainers-features/alpine-git:0": {}
// }

// // Features to add to the dev container. More info: https://containers.dev/features.
// // "features": {},

// // Use 'forwardPorts' to make a list of ports inside the container available locally.
// // "forwardPorts": [],

// // Use 'postCreateCommand' to run commands after the container is created.
// // "postCreateCommand": "uname -a",

// // Configure tool-specific properties.
// // "customizations": {},

// // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// // "remoteUser": "root"
// }

{
"name": "Local Dockerfile",
"build": {
"context": "..",
"dockerfile": "../Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"mateuszchudyk.hexinspector",
"DavidAnson.vscode-markdownlint",
"doinkythederp.nasm-language-support",
"jack89ita.open-file-from-path",
"mcu-debug.memory-view",
"NateAGeek.memory-viewer",
"mcu-debug.debug-tracker-vscode",
"ms-vscode.hexeditor",
"iliazeus.vscode-ansi",
// "cschlosser.doxdocgen",
"ms-vscode.makefile-tools"
]
}
},
"runArgs": ["--privileged", "-e", "DISPLAY=host.docker.internal:0.0"]
}
// // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
// {
// "name": "Ubuntu",
// // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/base:jammy",
// "features": {
// "ghcr.io/devcontainers/features/git-lfs:1": {},
// "ghcr.io/cirolosapio/devcontainers-features/alpine-git:0": {}
// }

// // Features to add to the dev container. More info: https://containers.dev/features.
// // "features": {},

// // Use 'forwardPorts' to make a list of ports inside the container available locally.
// // "forwardPorts": [],

// // Use 'postCreateCommand' to run commands after the container is created.
// // "postCreateCommand": "uname -a",

// // Configure tool-specific properties.
// // "customizations": {},

// // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// // "remoteUser": "root"
// }

{
"name": "Local Dockerfile",
"build": {
"context": "..",
"dockerfile": "Dockerfile",
"args": {
"HTTP_PROXY": "http://host.docker.internal:3128",
"HTTPS_PROXY": "http://host.docker.internal:3128",
"NO_PROXY": "localhost,127.0.0.1"
}
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"mateuszchudyk.hexinspector",
"DavidAnson.vscode-markdownlint",
"doinkythederp.nasm-language-support",
"jack89ita.open-file-from-path",
"mcu-debug.memory-view",
"NateAGeek.memory-viewer",
"mcu-debug.debug-tracker-vscode",
"ms-vscode.hexeditor",
"iliazeus.vscode-ansi",
// "cschlosser.doxdocgen",
"ms-vscode.makefile-tools"
]
}
},
"runArgs": ["--privileged", "-e", "DISPLAY=host.docker.internal:0.0"]
}
54 changes: 0 additions & 54 deletions Dockerfile

This file was deleted.

0 comments on commit 55d24b6

Please sign in to comment.