This repository has been archived by the owner on Apr 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install chromium-browser to make debug support(node-inspector)
- Loading branch information
Showing
4 changed files
with
89 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 @@ | ||
/.runtime/ |
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,38 @@ | ||
# NodeJS and npm, with chromium-browser, As the basic environment for development | ||
# ---- | ||
# build image: | ||
# docker build --force-rm -t platbase.com/dev.nodejs-debug:1.0 . | ||
# run: | ||
# docker run -it --rm -p 8080:8080 \ | ||
# -v /tmp/nodejs.ws:/workspace -v /tmp/nodejs.data:/data \ | ||
# -v /tmp/.X11-unix:/tmp/.X11-unix platbase.com/dev.nodejs-debug:1.0 | ||
|
||
FROM platbase.com/dev.nodejs:1.0 | ||
MAINTAINER https://github.com/platbase | ||
|
||
# Mappings | ||
EXPOSE 8080 | ||
VOLUME ["/workspace", "/data", "/tmp/.X11-unix"] | ||
|
||
# DISPLAY | ||
ENV DISPLAY ":0" | ||
|
||
# Entry - force work with user "u01" | ||
CMD /start-nodejs-shell.sh | ||
|
||
############################################################################### | ||
|
||
# make sure the package repository is up to date | ||
RUN apt-get update | ||
|
||
# Install zh-CN support | ||
RUN apt-get install -y language-pack-zh-hans | ||
RUN apt-get install -y ttf-ubuntu-font-family | ||
RUN apt-get install -y ttf-wqy-zenhei ttf-wqy-microhei | ||
|
||
# Install Chromium | ||
RUN apt-get install -y chromium-browser | ||
|
||
# Prepare starting commands | ||
ADD files/start-nodejs-shell.sh /start-nodejs-shell.sh | ||
RUN chmod +x /start-nodejs-shell.sh |
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,28 @@ | ||
#!/bin/bash | ||
|
||
# SHELL_ROOT - Location(Path) of this batch file | ||
SHELL_ROOT=$(cd "$(dirname "$0")"; pwd) | ||
|
||
mkdir -p "${SHELL_ROOT}/.runtime/cache" | ||
mkdir -p "${SHELL_ROOT}/.runtime/global" | ||
touch "${SHELL_ROOT}/.runtime/devops.platbase.com-docker-data" | ||
|
||
# Find avaliable ports between 8080 to 9080 | ||
LOWERPORT=8080 | ||
UPPERPORT=9080 | ||
# FIXME: "netstat -ntpl" warning: | ||
# Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.. | ||
lp=null | ||
for (( port = LOWERPORT ; port <= UPPERPORT ; port++ )); do | ||
netstat -ntpl 2>/dev/null | grep ":$port " | ||
[ $? -eq 1 ] && { lp=$port; break; } | ||
done | ||
[ "$lp" = "null" ] && { echo "No free local ports available(between $LOWERPORT and $UPPERPORT)"; exit 2; } | ||
|
||
echo ">>> Find avaliable local port: $port ." | ||
|
||
docker run -it --rm -p $port:8080 \ | ||
-v "`pwd`":/workspace \ | ||
-v "${SHELL_ROOT}/.runtime":/data \ | ||
-v /tmp/.X11-unix:/tmp/.X11-unix \ | ||
platbase.com/dev.nodejs-debug:1.0 |
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,22 @@ | ||
#!/bin/bash | ||
echo "*** Development environment with NodeJS and Npm ***" | ||
set -o errexit | ||
|
||
# Env setup | ||
/docker-base-init/docker-boot | ||
|
||
/docker-base-init/set-PS1 NodeJS | ||
/docker-base-init/set-CMD "cd /workspace" | ||
/docker-base-init/set-PATH "./node_modules/.bin:/data/global/bin" | ||
/docker-base-init/set-PATH "/opt/nodejs/node-v${VERSION}-linux-x64/bin:/opt/nodejs/node-v${VERSION}-linux-x64/bin/npm-global/bin" | ||
|
||
# Save Chromium profile to /data/.chromium | ||
echo ">>> Redirect chromium profile directory to /data ..." | ||
mkdir -p /home/u01/.config; chown u01:u01 /home/u01/.config | ||
mkdir -p /data/.chromium; chown u01:u01 /data/.chromium | ||
ln -s /data/.chromium /home/u01/.config/chromium | ||
ls -al ~u01/.config/chromium | ||
|
||
echo "========" | ||
|
||
su - u01 |