SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы
Список вопросов ПечатьМетки: node.js docker .gitlab-ci.yml
| RemiZOffAlex Создано: 2019-10-29 02:10:28.767239 Обновлено: 2019-10-29 02:10:28.767239 |
|---|
Структура каталогов. ├── app │ └── hello-world.js ├── Dockerfile └── .gitlab-ci.yml Файл hello-world.js
const http = require('http');
const hostname = '0.0.0.0';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello, World!\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
Файл DockerfileFROM node:12 MAINTAINER RemiZOffAlex <remizoffalex@gmail.com> RUN node --version RUN npm --version WORKDIR /app COPY ./app /app EXPOSE 3000 CMD [ "node", "/app/hello-world.js"] Файл .gitlab-ci.ymlstages: - build buildok: stage: build script: - docker build -t node-example ./ |