Skip to content

Instantly share code, notes, and snippets.

@dangtrinhnt
Last active April 5, 2021 15:49
Show Gist options
  • Save dangtrinhnt/b6004667a2fcf1960ca53819fe662752 to your computer and use it in GitHub Desktop.
Save dangtrinhnt/b6004667a2fcf1960ca53819fe662752 to your computer and use it in GitHub Desktop.
Sample Windows container Dockerfile running a Java application
FROM mcr.microsoft.com/windows/servercore:ltsc2019
# everything will be installed inside this directory inside the container
WORKDIR "C:/ProgramData"
# install chocolately package manager
RUN @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" -Y
RUN choco install openjdk8 -Y
RUN refreshenv
ADD myapplication.war "C:/ProgramData"
EXPOSE 8080
CMD ["java", "-jar", "C:/ProgramData/myapplication.war"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment