Browse Source

Merge pull request #8 from JetBrains/docker

Add docker files
pull/15/head
Nikolay Igotti 4 years ago committed by GitHub
parent
commit
04b9190ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      ci/docker/linux/Dockerfile
  2. 22
      ci/docker/linux/README.MD
  3. 47
      ci/docker/windows/Dockerfile
  4. 22
      ci/docker/windows/README.md
  5. 16
      ci/docker/windows/install_git.ps1
  6. 11
      ci/docker/windows/install_jdk.ps1
  7. 8
      ci/docker/windows/install_python.ps1
  8. 11
      ci/release.md

34
ci/docker/linux/Dockerfile

@ -0,0 +1,34 @@
FROM ubuntu:trusty-20191217
# Update binutils, g++, gcc
RUN apt-get update -y && \
apt-get install build-essential software-properties-common -y && \
add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
apt-get update -y && \
apt-get install binutils-2.26 && \
apt-get install build-essential software-properties-common -y && \
apt-get update && \
apt-get install gcc-9 g++-9 -y && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 && \
update-alternatives --config gcc
ENV PATH=/usr/lib/binutils-2.26/bin:$PATH
# Install libs & tools
ENV DEPOT_TOOLS=/usr/depot_tools
ENV PATH=$DEPOT_TOOLS:$PATH
RUN apt-get install git python wget -y && \
apt-get install fontconfig libfontconfig1-dev libglu1-mesa-dev curl zip -y && \
git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' $DEPOT_TOOLS
# Install Java
ENV JAVA_HOME=/usr/java/11
ENV PATH=$JAVA_HOME/bin:$PATH
RUN JAVA_URL=https://corretto.aws/downloads/latest/amazon-corretto-11-x64-linux-jdk.tar.gz && \
JAVA_ARCHIVE=/tmp/jdk.tar.gz && \
JAVA_BASE=/usr/java/ && \
wget $JAVA_URL --output-document $JAVA_ARCHIVE && \
mkdir -p $JAVA_BASE && \
tar -xzf $JAVA_ARCHIVE --directory $JAVA_BASE && \
find $JAVA_BASE -type d -maxdepth 1 -name "amazon-corretto-11*linux-x64" -exec mv {} $JAVA_HOME \; && \
rm $JAVA_ARCHIVE
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8

22
ci/docker/linux/README.MD

@ -0,0 +1,22 @@
### Build image
```
docker build -t skiko-build-ubuntu-1404-amd64:latest .
```
### Run container
```
docker run -it skiko-build-ubuntu-1404-amd64:latest
```
* To customize memory constraints, use `-m` argument (e.g. `-m 2G`)
* To customize number of available CPU cores, use `--cpus` argument (e.g. `--cpus=2`)
### Publish image to Compose repo
```
docker login public.registry.jetbrains.space
docker tag skiko-build-ubuntu-1404-amd64:latest public.registry.jetbrains.space/p/compose/docker/skiko-build-ubuntu-1404-amd64:latest
docker push public.registry.jetbrains.space/p/compose/docker/skiko-build-ubuntu-1404-amd64:latest
```

47
ci/docker/windows/Dockerfile

@ -0,0 +1,47 @@
# escape=`
# Use the latest Windows Server Core image with .NET Framework 4.8.
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
# Install MSVC C++ compiler, CMake, and MSBuild.
ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\Temp\vs_buildtools.exe
ADD https://aka.ms/vs/16/release/channel C:\Temp\VisualStudio.chman
RUN C:\Temp\vs_buildtools.exe `
--quiet --wait --norestart --nocache `
--installPath C:\BuildTools `
--channelUri C:\Temp\VisualStudio.chman `
--installChannelUri C:\Temp\VisualStudio.chman `
--add Microsoft.VisualStudio.Workload.VCTools;includeRecommended `
--add Microsoft.Component.MSBuild `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
RUN setx /M SKIKO_VSBT_PATH "C:\BuildTools"
# Install Java
COPY install_jdk.ps1 C:\TEMP\install_jdk.ps1
RUN powershell C:\TEMP\install_jdk.ps1 -url https://corretto.aws/downloads/latest/amazon-corretto-11-x64-windows-jdk.zip -targetDir C:\jdk11
RUN setx /M PATH "C:\jdk11\bin;%PATH%"
RUN setx /M JAVA_HOME C:\jdk11
ENV PYTHON_VERSION=2.7.18
ENV PYTHON_RELEASE=2.7.18
ADD install_python.ps1 C:\TEMP\install_python.ps1
RUN powershell C:\TEMP\install_python.ps1
ADD https://bintray.com/jetbrains/skija/download_file?file_path=zip.zip C:\TEMP\zip.zip
RUN tar -xf C:\TEMP\zip.zip
RUN setx /M PATH "C:\zip;%PATH%"
COPY install_git.ps1 C:\TEMP\install_git.ps1
RUN powershell C:\TEMP\install_git.ps1
RUN setx /M PATH "C:\Git\cmd;C:\Git\bin;C:\Git\usr\bin;%PATH%"
RUN git.exe clone "https://chromium.googlesource.com/chromium/tools/depot_tools.git" "C:\depot_tools"
RUN setx /M PATH "C:\depot_tools;%PATH%"
# Define the entry point for the docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

22
ci/docker/windows/README.md

@ -0,0 +1,22 @@
### Build image
```
docker build -t skiko-build-windows-ltsc2019-amd64:latest -m 2G .
```
### Run container
```
docker run -it skiko-build-windows-ltsc2019-amd64:latest
```
* To customize memory constraints, use `-m` argument (e.g. `-m 2G`)
* To customize number of available CPU cores, use `--cpus` argument (e.g. `--cpus=2`)
### Publish image to Compose repo
```
docker login public.registry.jetbrains.space
docker tag skiko-build-windows-ltsc2019-amd64:latest public.registry.jetbrains.space/p/compose/docker/skiko-build-windows-ltsc2019-amd64:latest
docker push public.registry.jetbrains.space/p/compose/docker/skiko-build-windows-ltsc2019-amd64:latest
```

16
ci/docker/windows/install_git.ps1

@ -0,0 +1,16 @@
# Install 7zip
Write-Host 'Downloading 7z...'
$7zinstaller='C:\TEMP\7zsetup.exe'
(New-Object System.Net.WebClient).DownloadFile('https://www.7-zip.org/a/7z1900-x64.exe', $7zinstaller)
Write-Host 'Installing 7z...'
Start-Process $7zinstaller -ArgumentList '/S' -Wait
Remove-Item $7zinstaller -Force
$env:Path += ';C:\Program Files\7-Zip\'
# Install Git
Write-Host 'Downloading Git...'
$gitarchive='C:\TEMP\portableGit.7z.exe'
(New-Object System.Net.WebClient).DownloadFile('https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/PortableGit-2.28.0-64-bit.7z.exe', $gitarchive)
Write-Host 'Installing Git...'
7z.exe x $gitarchive -o'C:\Git'
Remove-Item $gitarchive -Force

11
ci/docker/windows/install_jdk.ps1

@ -0,0 +1,11 @@
param ($url, $targetDir)
$archiveFile="C:\TEMP\corretto-11-jdk.zip"
Write-Host ('Downloading {0} ...' -f $url)
(New-Object System.Net.WebClient).DownloadFile($url, $archiveFile)
Write-Host 'Installing ...'
tar -xf $archiveFile
# rename an unpacked directory like 'jdk11.0.10' to 'jdk11'
$jdkDir=Get-ChildItem -Filter "jdk11.*"|Select-Object -First 1
Rename-Item -Path $jdkDir.FullName -NewName $targetDir
Remove-Item $archiveFile -Force
Write-Host 'Installation is complete.'

8
ci/docker/windows/install_python.ps1

@ -0,0 +1,8 @@
$url = ('https://www.python.org/ftp/python/{0}/python-{1}.amd64.msi' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION)
$installer='C:\TEMP\python.msi'
Write-Host ('Downloading {0} ...' -f $url)
(New-Object System.Net.WebClient).DownloadFile($url, $installer)
Write-Host 'Installing ...'
Start-Process msiexec -Wait -ArgumentList @('/i', $installer, '/quiet', '/qn', 'TARGETDIR=C:\Python', 'ALLUSERS=1', 'ADDLOCAL=DefaultFeature,Extensions,TclTk,Tools,PrependPath')
Remove-Item $installer -Force
Write-Host 'Python installation is complete.'

11
ci/release.md

@ -57,3 +57,14 @@ to download maven artifacts:
### Publishing Compose Desktop ### Publishing Compose Desktop
Run a new build in [Compose configuration](https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Skija_JetpackComposeMpp_Dev) Run a new build in [Compose configuration](https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Skija_JetpackComposeMpp_Dev)
### Building Docker Images
For building locally see corresponding the instructions:
* for [Linux](docker/linux/README.md),
* for [Windows](docker/windows/README.md).
For updating internal images on Docker registry run a build in one of
the corresponding configurations:
* for [Linux](https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Compose_Docker_Linux),
* for [Windows](https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Compose_Docker_Windows)

Loading…
Cancel
Save