-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request !1 from Osprey/docker-vscode
- Loading branch information
Showing
3 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker build -f nes-dockerfile -t nes.osprey.io/nes-build-run . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "osprey nes", | ||
|
||
// Default path to open when attaching to a new container. | ||
"workspaceFolder": "/home/osprey/work", | ||
"image":"nes.osprey.io/nes-build-run", | ||
|
||
// Set *default* container specific settings.json values on container create. | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "bash", | ||
"cmake.automaticReconfigure": false, | ||
"cmake.configureOnEdit": false | ||
}, | ||
"extensions": [ | ||
// Put your favourite extensions here | ||
// "mhutchie.git-graph", | ||
// "eamodio.gitlens", | ||
// "ms-vscode.cmake-tools", | ||
// "ms-vscode.cpptools", | ||
// "ms-vscode.cpptools-extension-pack", | ||
] | ||
} | ||
}, | ||
|
||
// An array port numbers to forward | ||
"forwardPorts": [], | ||
// "postCreateCommand": "echo 'hello container'", | ||
// Container user VS Code should use when connecting | ||
"remoteUser": "osprey", | ||
// Set environment variables for VS Code and sub-processes | ||
"containerEnv": { | ||
"MY_VARIABLE": "some-value", | ||
// "DISPLAY": ":0" | ||
}, | ||
|
||
"runArgs": [ | ||
"--network=host" | ||
], | ||
"privileged": true, | ||
"mounts": [ | ||
// for audio device | ||
"source=/dev/snd,target=/dev/snd,type=bind,consistency=cached", | ||
// for video | ||
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
FROM ubuntu:18.04 as builder | ||
|
||
MAINTAINER Osprey | ||
|
||
#docker build -f nes-dockerfile -t nes.osprey.io/nes-build-run . | ||
|
||
# docker start nes-build | ||
# docker attach nes-build | ||
# docker exec -it nes-build /bin/bash | ||
|
||
|
||
# 创建用户 cmd:id | ||
ARG USERNAME=osprey | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
&& apt-get update \ | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
||
RUN apt-get update | ||
# for cmd: add-apt-repository | ||
RUN apt -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates | ||
RUN add-apt-repository ppa:xmake-io/xmake -y && apt-get update && apt-get install -y xmake | ||
RUN apt-get install -y p7zip-full libsdl2-dev | ||
|
||
RUN apt-get install -y git make gcc | ||
# option | ||
RUN apt-get install -y nano iputils-ping | ||
# setting the password of root to 123456 | ||
RUN echo 'root:123456' | chpasswd | ||
|
||
USER $USERNAME | ||
ENV HOME=/home/$USERNAME | ||
|
||
RUN mkdir /home/$USERNAME/work | ||
|
||
WORKDIR /home/$USERNAME/work | ||
|
||
RUN git clone https://gitee.com/Dozingfiretruck/nes && cd nes && xmake | ||
|
||
|
||
########################################### | ||
FROM ubuntu:18.04 as prod | ||
|
||
# | ||
ENV TZ=Asia/Shanghai | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
# 创建用户 cmd:id | ||
ARG USERNAME=osprey | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
&& apt-get update \ | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y p7zip-full libsdl2-dev | ||
|
||
USER $USERNAME | ||
ENV HOME=/home/$USERNAME | ||
|
||
RUN mkdir /home/$USERNAME/work | ||
WORKDIR /home/$USERNAME/work | ||
RUN echo "PS1='\[\e[0;33m\]\u@\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '" >> /home/$USERNAME/.bashrc | ||
|
||
COPY --from=0 /home/$USERNAME/work/nes/build/linux/x86_64/release/nes . | ||
COPY contra.nes . | ||
COPY SuperMarioBrosWorld.nes . | ||
#CMD ["~/work/nes contra.nes"] | ||
|
||
# run cmd: | ||
# docker run --name=nes-test --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/snd:/dev/snd --privileged -e DISPLAY=unix$DISPLAY nes.osprey.io/nes-build-run /bin/bash -c "./nes contra.nes" | ||
|