tosim 2016-12-01
PlayRaspberryPiNginxDocker
Theprojectwillbenamedasraspberrypi-nginx
normalMakefileasfollow
IMAGE=sillycat/public
TAG=raspberrypi-nginx
NAME=raspberrypi-nginx
prepare:
wgethttp://nginx.org/download/nginx-1.11.6.tar.gz-Pinstall/
docker-context:
build:docker-context
dockerbuild-t$(IMAGE):$(TAG).
run:
dockerrun-d-p80:80-v/opt/disk1/nas_cloud/sillycat/person:/data/sillycat-v/opt/disk1/nas_cloud/sillycat/share:/data/share--name$(NAME)$(IMAGE):$(TAG)
debug:
dockerrun-ti-p80:80-v/opt/disk1/nas_cloud/sillycat/person:/data/sillycat-v/opt/disk1/nas_cloud/sillycat/share:/data/share--name$(NAME)$(IMAGE):$(TAG)/bin/bash
clean:
dockerstop${NAME}
dockerrm${NAME}
logs:
dockerlogs${NAME}
publish:
dockerpush${IMAGE}:${TAG}
fetch:
dockerpull${IMAGE}:${TAG}
TheDockerfilewillshowhowIinstallthenginxsoftwareonubuntuinitialimage,Iamusing1.11.6versionwhichisthelatestcurrently.
#SetupnginxinDocker
#PrepretheOS
FROMresin/rpi-raspbian:jessie
MAINTAINERCarlLuo<[email protected]>
ENVDEBIAN_FRONTENDnoninteractive
RUNapt-get-yupdate
RUNapt-getinstall-yapt-utils
RUNapt-get-ydist-upgrade
RUNapt-getinstall-ybuild-essentialgccmake
RUNapt-getinstall-ylibpcre3libpcre3-devzlib1g-devlibgcrypt11-dev
#installnginx
RUNmkdir-p/tool
RUNmkdir-p/install
ADDinstall/nginx-1.11.6.tar.gz/install/
WORKDIR/install/nginx-1.11.6
RUN./configure--prefix=/tool/nginx-1.11.6
RUNmake
RUNmakeinstall
#confignginx
ADDconf/nginx.conf/tool/nginx-1.11.6/conf/
#starttheapplication
EXPOSE80
RUNmkdir-p/app/
ADDstart.sh/app/
WORKDIR/app/
CMD["./start.sh"]
Thescriptfilestart.shtostartthenginxserviceandkeepitrunningintheback
#!/bin/sh-ex
#startthenginx
cd/tool/nginx-1.11.6
sbin/nginx-g"daemonoff;"
SinceIdonotsetupstatichtml/jsprojectsyet,soIjustrunthisnginxprojectalonewithdefaultconf/nginx.conf
>makeprepare
>makebuild
>makerun
Visitthepagehttp://localhostwillwork.
References: