1

I'm trying to run a Docker image inside a GitHub Action:

FROM mcr.microsoft.com/windows/servercore:ltsc2019

RUN Invoke-WebRequest -Uri \
    "https://github.com/cyberspray2023/mingw64-distrib/releases/download/v10.0.0/mingw-w64-v10.0.0.tar.bz2" -OutFile "mingw-w64.tar.bz2"
RUN Expand-Archive -Path "mingw-w64.zip" -DestinationPath "C:\mingw64"
ENV PATH += ";C:\mingw64\mingw64\bin"

# Bug: The installer despite of options shows GUI.
# RUN Invoke-WebRequest -Uri \
#     "https://github.com/msys2/msys2-installer/releases/download/2023-03-18/msys2-x86_64-20230318.exe" -OutFile "msys2.exe"
# RUN .\msys2.exe --default-actions --accept-licenses -t c:\msys2

RUN Invoke-WebRequest -Uri \
    "https://download.visualstudio.microsoft.com/download/pr/61e8428f-7d28-4f39-867c-08f71e0a7869/1b791bed03e2cf2f19f16d640ad1e4ab/dotnet-sdk-7.0.100-win-x64.exe" \
    -OutFile "dotnet-sdk.exe"
RUN .\dotnet-sdk.exe /install /quiet /norestart

RUN Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311.exe" \
    -OutFile "wix.exe"
RUN .\wix.exe /quiet /norestart

# Install Chocolatey
RUN "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"

RUN Invoke-WebRequest -Uri https://cygwin.com/setup-x86_64.exe -OutFile cygwin.exe
RUN .\cygwin.exe -q -d -R c:\cygwin -s http://cygwin.mirror.constant.com -l bash coreutils

RUN choco install -y make git

The when I run it with the following GitHub Action:

name: Docker Example

on: [push]

jobs:
  build:
    runs-on: windows-latest
    steps:
      #- name: Set up Docker
      #  uses: docker/setup-docker@v2

      - name: Checkout code
        uses: actions/checkout@v2

      - name: Build Docker image
        run: docker build -t my-image:${{ github.sha }} -f windows/Dockerfile.windows .

      - name: Start Docker container
        run: docker run -v %cd%:/app -it my-image:${{ github.sha }} winpty make OS=windows ARCH=amd64 msi

I get the error:

Run docker run -v %cd%:/app -it my-image:d4a636fb666d12496514fcedb24c482454565e08 winpty make OS=windows ARCH=amd64 msi
  docker run -v %cd%:/app -it my-image:d4a636fb666d12496514fcedb24c482454565e08 winpty make OS=windows ARCH=amd64 msi
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'
Error: Process completed with exit code 1.

I tried to add -t flag to docker but that does not help.

porton
  • 5,214
  • 11
  • 47
  • 95
  • 2
    Have you tried run without `-it`? Seems that could be your issue, https://stackoverflow.com/questions/43099116/error-the-input-device-is-not-a-tty – aknosis Apr 06 '23 at 21:11

0 Answers0