Skip to content

Commit

Permalink
feat: 4bitcss Dockerfile ( Fixes #74 )
Browse files Browse the repository at this point in the history
Using ruby image
  • Loading branch information
James Brundage committed Sep 29, 2024
1 parent 0762513 commit aee2be6
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
# Thank you Microsoft! Thank you PowerShell! Thank you Docker!
FROM mcr.microsoft.com/powershell
FROM mcr.microsoft.com/powershell AS powershell

# InstallAptPackages determines additional packages to install
ARG InstallAptPackages=git curl ca-certificates libc6 libgcc1
FROM ruby:3.3.5-slim-bullseye AS jekyllrb

# Install additional packages
RUN apt-get update && apt-get install -y $InstallAptPackages
# Copy the module into the container
# Copy essentially everything from the PowerShell image into the final image
COPY --from=powershell /usr /usr
COPY --from=powershell /lib /lib
COPY --from=powershell /lib64 /lib64
COPY --from=powershell /bin /bin
COPY --from=powershell /opt /opt

# Set the module name to the name of the module we are building
ARG ModuleName=4bitcss
# Copy the module into the container
COPY . ./usr/local/share/powershell/Modules/$ModuleName
# Create a profile that imports the module, so it is available when the container starts.
RUN pwsh -c "New-Item -Path \$Profile -ItemType File -Force | Out-Null"
# Add the module to the profile
RUN pwsh -c "Add-Content -Path \$Profile -Value 'Import-Module $ModuleName' -Force"
ENV ModuleName=4bitcssb
ENV InstallPackages="build-essential","git"

# InstallModules determines additional modules to install
ARG InstallModules=PipeScript,PSSVG,ugit
SHELL ["/bin/pwsh", "-nologo", "-command"]

# Copy the module into the container
RUN --mount=type=bind,src=./,target=/Initialize /Initialize/Container.init.ps1

# Install additional modules
RUN pwsh -c "Install-Module -Name $InstallModules -Force -AcceptLicense -Scope CurrentUser"
# Add the modules to the profile
RUN pwsh -c "Add-Content -Path \$Profile -Value 'Import-Module $InstallModules' -Force"
# Set the entrypoint to the script we just created.
ENTRYPOINT [ "/bin/pwsh" ]

0 comments on commit aee2be6

Please sign in to comment.