728x90
반응형
SMALL
1. dockerfile 을 만든다
https://www.gyanblog.com/python/how-install-python-windows-command-line-Dockerfile/
*활용하는 이미지는 도커 jenkins agent 임
*도커 jenkins agent 는 windowsservercore-1809 의 확장이며, git 이 설치되어 있음 !!!! 일 하나 줄었음 ㅎ_ㅎ
FROM jenkins/inbound-agent:windowsservercore-1809
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN New-Item C:/temp -ItemType Directory; \
New-Item C:/data -ItemType Directory;
WORKDIR C:/temp
ENV PYTHON_VERSION 3.9.1
ENV PYTHON_RELEASE 3.9.1
RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \
Write-Host ('Downloading {0} ...' -f $url); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \
\
Write-Host 'Installing ...'; \
# https://docs.python.org/3.7/using/windows.html#installing-without-ui
Start-Process python.exe -Wait \
-ArgumentList @( \
'/quiet', \
'InstallAllUsers=1', \
'TargetDir=C:\Python39', \
'PrependPath=1', \
'Shortcuts=0', \
'Include_doc=0', \
'Include_pip=0', \
'Include_test=0' \
); \
\
#the installer updated PATH, so we should refresh our local value
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
\
Write-Host 'Verifying install ...'; \
Write-Host ' python --version'; python --version; \
\
Write-Host 'Removing ...'; \
Remove-Item python.exe -Force; \
\
Write-Host 'Complete.'
# https://github.com/pypa/get-pip
ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py
ENV PYTHON_GET_PIP_SHA256 421ac1d44c0cf9730a088e337867d974b91bdce4ea2636099275071878cc189e
RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $env:PYTHON_GET_PIP_URL -OutFile 'get-pip.py'; \
Write-Host ('Verifying sha256 ({0}) ...' -f $env:PYTHON_GET_PIP_SHA256); \
if ((Get-FileHash 'get-pip.py' -Algorithm sha256).Hash -ne $env:PYTHON_GET_PIP_SHA256) { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host ('Installing pip ...'); \
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
; \
Remove-Item get-pip.py -Force; \
\
Write-Host 'Verifying pip install ...'; \
pip --version; \
\
Write-Host 'Complete.'
2. 이미지를 빌드한다
-편의상 Dockerfile 이 있는 디렉토리에서 실행했음
docker build --tag jenkinsagentpython39 ./
3. Docker Desktop 에 이미지 추가 된 것 확인
4. Docker Run
docker run jenkinsagentpython39 -Url http://Jenkins:8080 -WorkDir "C:/Users/jenkins/Agent" -Secret [***] -Name docker-py-1
4-1. 기능 확인
728x90
반응형
LIST
'DevOps > 컨테이너' 카테고리의 다른 글
EKS Load Balancer - 쿠버네티스 Ingress, Service Load Balancer 로 프로비저닝 하기 (0) | 2023.04.09 |
---|---|
EKS 클러스터 만들기 (0) | 2023.04.09 |
(Docker) Windows Docker Agent Images / 도커 윈도우 컨테이너를 젠킨스 slave 로 연결하기 (0) | 2022.02.09 |
(Docker Desktop) 윈도우 tcp 서비스 도커 컨테이너로 만들기 (0) | 2022.02.07 |
(Docker Desktop) Docker 로 IIS 띄우기 (0) | 2022.02.07 |