-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 4bitcss Dockerfile ( Fixes #74 )
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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" ] |