Skip to content

questcollector/node_devops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node_devops

DevOps tools with

  • node.js
    express web service
  • github
    devops/gitops repository
  • jenkins
    CI tool
  • docker
    build an application image, then push it to docker hub

reference

1. dockerize node app

2. Jenkins 구성 (docker 기반)

  • docker network 생성 (작업 디렉토리 jenkins)
mkdir jenkins
cd jenkins
docker network create jenkins
  • jenkins Dockerfile 구성
# jenkins/Dockerfile
FROM jenkins/jenkins:latest AS docker
USER root
RUN apt-get update && apt-get install -y lsb-release
RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \
  https://download.docker.com/linux/debian/gpg
RUN echo "deb [arch=$(dpkg --print-architecture) \
  signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \
  https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
RUN apt-get update && apt-get install -y docker-ce-cli

# kustomize install
FROM docker AS kustomize
WORKDIR /usr/bin/
RUN curl --silent --location --remote-name https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.4.1/kustomize_v4.4.1_linux_arm64.tar.gz
RUN tar -xzf kustomize_v4.4.1_linux_arm64.tar.gz

# blueocean은 필요시 추가 설치
FROM kustomize AS jenkins
USER jenkins
RUN jenkins-plugin-cli --plugins "docker-workflow:1.26"
  • docker image build
docker build -t jenkins-server:1.0 .
  • docker compose 구성
# jenkins/docker-compose.yml
version: '3'
services:
  jenkins-blueocean:
    depends_on:
      - jenkins-docker
    image: jenkins-server:1.0
    container_name: jenkins-server
    privileged: true
    environment:
      DOCKER_HOST: tcp://docker:2376
      DOCKER_CERT_PATH: /certs/client
      DOCKER_TLS_VERIFY: 1
    networks:
      jenkins:
    volumes:
      - "jenkins-data:/var/jenkins_home"
      - "jenkins-docker-certs:/certs/client:ro"
    ports:
      - "8080:8080"
      - "50000:50000"
  jenkins-docker:
    image: docker:dind
    container_name: jenkins-docker
    privileged: true
    command: --storage-driver=overlay2
    environment:
      DOCKER_TLS_CERDIR: /certs
    networks:
      jenkins:
        aliases:
          - docker
    volumes:
      - "jenkins-docker-certs:/certs/client"
      - "jenkins-data:/var/jenkins_home"
    ports:
      - "2376:2376"

networks:
  jenkins:
    external: true
    name: jenkins
volumes:
  jenkins-data:
    external: true
  jenkins-docker-certs:
    external: true
  • jenkins 실행
docker-compose -d up

3. Pipeline / Jenkinsfile 구성

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published