
목적
Jenkins 도커 이미지에 Python 및 Fabric 추가
개발 환경 : 우분투(리눅스)
Docker File
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
FROM jenkins/jenkins:latest
USER root
# Pyhton3.x / fabric install
# Cache busting :: Always combine RUN apt-get update with apt-get install in the same RUN statement
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
# In addition, when you clean up the apt cache by removing /var/lib/apt/lists it reduces the image size, since the apt cache is not stored in a layer. Since the RUN statement starts with apt-get update, the package cache is always refreshed prior to apt-get install.
    && rm -rf /var/lib/apt/lists/*
# Setting sybolic link Pyhton3
RUN ln -s /usr/bin/python3 /usr/bin/python
# Fabric install
RUN pip3 install fabric3 \
    Jinja2 \
    redis
Docker Compose
# 호스트의 Docker 명령어 사용 가능하도록 설정
# http://pragmaticstory.com/?p=113
version: '3.7'
services:
  jenkins:
    build: ./
    ports:
      - '8081:8080'
    volumes:
      - ./volume:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
      - /etc/docker/daemon.json:/etc/docker/daemon.json
Host의 Docker 커맨드 사용을 위한 Volume 바인딩
volumes:
      - ...
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
      - ...'devops' 카테고리의 다른 글
| Docker Swarm (0) | 2021.08.29 | 
|---|---|
| [Redis] Redis Sentinel + HAproxy (0) | 2021.08.08 | 
| MQTT/AMQP (0) | 2021.06.18 | 
| Volatile / Lock (0) | 2021.06.17 | 
| ASP.Net Core에서 NSwag 사용하기 (0) | 2021.02.14 |