Skip to content

Instantly share code, notes, and snippets.

@hemikak
Last active April 11, 2019 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hemikak/b9b42f0d3f6be29886e3585cf5963576 to your computer and use it in GitHub Desktop.
Save hemikak/b9b42f0d3f6be29886e3585cf5963576 to your computer and use it in GitHub Desktop.
Ballerina Docker Image for Windows
FROM openjdk:8u201-jdk-nanoserver-sac2016
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
LABEL maintainer="dev@ballerina.io"
ARG BALLERINA_DIST
RUN New-Item -path C:\ -name "ballerina" -type directory | Out-Null;
RUN New-Item -path C:\ -name "tmp" -type directory | Out-Null;
# copy distribution to created `tmp` folder
COPY $BALLERINA_DIST C:\\tmp
# unzip archive to `ballerina` folder
RUN Expand-Archive C:\tmp\$env:BALLERINA_DIST C:\ballerina;
# remove archive
RUN Remove-Item C:\tmp -Force -Recurse;
# rename folder to `runtime`
RUN Get-ChildItem -Path C:\ballerina\ -Recurse -Directory | \
ForEach { \
Rename-Item -Path $_.FullName -NewName "runtime"; \
break; \
};
# set BALLERINA_HOME environment variable
RUN SETX /M BALLERINA_HOME C:\ballerina\runtime;
# add ballerina batch file to path
RUN $ballerinaPath = '{0}\bin' -f $Env:BALLERINA_HOME; \
$newPath = ('{0};{1}' -f $ballerinaPath, $Env:PATH); \
SETX /M PATH $newPath;
# set working directory
RUN New-Item -path C:\ballerina\ -name "home" -type directory | Out-Null;
WORKDIR C:\\ballerina\\home
# VOLUME C:\\ballerina\\home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment