Do It Yourself – Tutorials – How To Deploy Your Webpage Using Alpine Image And Lighttpd Server?

by | Jul 9, 2020 | 0 comments

Do It Yourself – Tutorials – How To Deploy Your Webpage Using Alpine Image And Lighttpd Server?

by | Jul 9, 2020 | Do It Yourself - Build Your Own Website | 0 comments

Do It Yourself – Website Tutorials



Welcome back to my channel. In this tutorial we are going to see how we can create our own docker image for a webserver, by installing light httpd server on an alpine base image. We will be also copying the necessary configuration files and your website index dot html page in the docker image. The end product is a webserver container running with your webpage, for this we will build the image from docker file and run the container.

There are 3 files which we will be creating as part of this tutorial. One is the webpage , for this I will be creating a simple index.html page. The second one is the configuration file for the httpd server. And the final one is the dockerfile. We will be creating all these files inside single folder in which the docker file is saved. I will be creating individual folder to save the html and configuration files.
——————————————————————————————————————
Full docker file and configuration is available below.

Github: https://github.com/shazforiot/Create-Docker-File-to-Deploy-Your-Website-using-Alpine-Image.git
————————————————————————————————————–
———————————————————————————————————–
Vi Dockerfile

FROM alpine
RUN apk update && apk upgrade
RUN apk add –update lighttpd
COPY ./conf/* /etc/lighttpd/
COPY ./html/* /var/www/html/
EXPOSE 80
CMD [“lighttpd”,”-D”,”-f”,”/etc/lighttpd/lighttpd.conf”]
——————————————————————————————————–
—————————————————————————————————–
vi lighttpd.conf

server.document-root = “/var/www/html”
server.port = 80
server.indexfiles = (“index.html”)
mimetype.assign = (
“.html” =greaterthansymbol(as youtube doesn’t support angled bracket) “text/html”,
“.txt” =sameasabove “text/plain”,
“.jpg” =sameasabove “image/jpeg”,
“.png” =sameasabove “image/png”
)
————————————————————————————————
————————————————————————————————–
docker build -t mywebserver:v1.0 .

docker run -d –name mywebserver -p 8080:80 mywebserver:v1.0
======================================================
Follow me @:
https://www.instagram.com/thetips4you
https://www.youtube.com/channel/UCoOq-DtESvayx5yJE5H6-qQ
https://fb.me/thetipsforall
http://www.thetips4you.com
=====================================================

source