Jenkins with .net core on docker container

Build .net Coreไม่ได้!!

เอายังไงดีละทีนี้ จะไปหาเครื่องมาทำ Agent ก็ไม่ไหวเพราะมี Notebook เครื่องเดียว

  • Docker (Linux Container) (ฺBase image มีขนาดไฟล์เล็กกว่าของฝั่ง Windows มากๆ ครับ เลยเลือกใช้งานตัวนี้แทน)
  • VS Code
  • Internet
Docker extension for VS Code
Create new Dockerfile
FROM jenkins/jenkins:latest
MAINTAINER Vatthanachai W.(vatthanachai.w@gmail.com)
USER root
RUN apt-get update && \ 
apt-get upgrade -y && \
apt-get dist-upgrade -y
RUN apt-get install -y apt-transport-https \
&& apt-get install -y --no-install-recommends \
curl libunwind8 gettext apt-transport-https && \
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg && \
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg && \
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/dotnetdev.list' && \
apt-get update
RUN apt-get install -y dotnet-sdk-2.1 && \
export PATH=$PATH:$HOME/dotnet && \
dotnet --version
RUN apt-get clean && apt-get autoremove -y
USER jenkins
All code
Vs Code >> Terminal
$> docker build -t jenkin-netcode:2.1 .
Build Image Inprogress
After build image success
$> docker images
$> docker run -d -p 8080:8080 --name jenkins jenkin-netcode:2.1
Jenkins Start page
$> docker logs <Container ID || Container Name>
$> docker logs jenkins
Jenkins initial setup password
Jenkins’s plug-in install
Create new project in jenkins
mkdir hello && \
cd hello && \
dotnet new console && \
dotnet build

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store