Docker Cookbook


CI/CD: Setting Up a Development Environment



Download 6,31 Mb.
Pdf ko'rish
bet233/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   229   230   231   232   233   234   235   236   ...   260
Bog'liq
Docker Cookbook

10.1 CI/CD: Setting Up a Development Environment
Contributed by Pini Reznik
Problem
You need a consistent and reproducible development environment for your Node.js
application. You don’t want to rebuild the Docker image every time you make small
changes to the Node.js sources.
Solution
Create a Docker image that includes all the required dependencies. Mount external
volumes during the development and use the ADD instruction in the Dockerfile for
distributing the image with the application to other developers.
First you need a Node.js Hello World application that includes two files:
app.js
:
// Load the http module to create an http server.
var
http
=
require
(
'http'
);
// Configure our HTTP server to respond with Hello World to all requests.
var
server
=
http
.
createServer
(
function
(
request
,
response
)
{
response
.
writeHead
(
200
,
{
"Content-Type"
:
"text/plain"
});
response
.
end
(
"Hello World"
);
});
// Listen on port 8000, IP defaults to "0.0.0.0"
server
.
listen
(
8000
);
// Put a friendly message on the terminal
console
.
log
(
"Server running at http://127.0.0.1:8000/"
);
300 | Chapter 10: Application Use Cases


package.json
:
{
"name"
:
"hello-world"
,
"description"
:
"hello world"
,
"version"
:
"0.0.1"
,
"private"
:

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   229   230   231   232   233   234   235   236   ...   260




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish