Open lamw opened 2 years ago
Hi @lamw. I took a look at the example Dockerfiles you provided. I think it would be possible for a buildpack to install PowerShell, and I'd be interested to hear from other users who would benefit from this.
However, I also noticed that your Dockerfiles are based on PhotonOS. Currently, Paketo buildpacks are currently only compatible with Ubuntu Bionic
@paketo-buildpacks/stacks-maintainers do you have any more context around PhotonOS and buildpacks' compatibility?
@fg-j We definitely would have users who would use this as they currently consume our PowerShell images
In theory, we should be able to also use Ubuntu but we chose Photon as thats our base-linux OS. Let me see if I can quickly put one together based on the original example but using Ubuntu Bionic and see if that helps
Our goal would be to use PhotonOS (which is an RPM-based system) for our base image
@fg-j Here's quick Dockerfile I've just put together using Ubuntu https://gist.github.com/lamw/bda4820e33532319423e6669c73af905
I was having some client issues (not sure why I can't pull from dockerhub but if you're able to, you should be able to simply replace the version of Ubuntu)
Stacks maintainer here... I don't know much about the Photon OS but from my preliminary checks, it's a minimal Linux OS. I haven't dug into what's installed or not but if it's minimal I'm not sure if the .NET Core buildpacks would work on it. We'd have to do some investigation probably to see if the buildpacks/dependencies would "just work"
Hi @sophiewigmore - Would you have any updates on this or something I could help test or validate?
Hey @lamw. Here's something that may be of interest to you: Paketo's jam
CLI has added a jam create-stack
command that will produce a CNB stack given a stack.toml
stack descriptor and some Dockerfiles.
You could use this tool to create a Photon-based stack and test it against the existing Paketo buildpacks. This would be a great starting point for understanding the current buildpacks' interoperability with other stacks
If you find incompatibilities, please file issues! Paketo is interested in making buildpacks more stack-agnostic when possible.
@fg-j
Just gave jam
a try on MacOS with the following but it throws error:
❯ jam create-stack --config stack.toml --build-output build.oci --run-output run.oci
Building photon-powershell
Building on linux/amd64
Building base images
ERRO[0000] Tar: Can't stat file /Users/lamw to tar: open /Users/lamw/.Trash: operation not permitted
ERRO[0000] Tar: Can't stat file /Users/lamw to tar: open /Users/lamw/.Trash: operation not permitted
I'm using our Dockerfile based on Photon and here's stack.toml
config:
id = "photon-powershell"
homepage = "https://williamlam.com"
maintainer = "William Lam"
platforms = ["linux/amd64"]
[build]
dockerfile = "Dockerfile.ps"
description = "PowerShell Base Image"
uid = 1001
gid = 1000
[run]
dockerfile = "Dockerfile.ps"
description = "PowerShell Base Image"
uid = 1002
gid = 1000
@lamw What's pwd
where you're running jam create-stack
from?
@fg-j I'm running this in my home directory on my MacOS system /Users/lamw
That may be the source of your problem. The jam create-stack
command attempts to package up the entire current working directory as the "build context" for use in a Docker build. Try creating a subdirectory with your stack descriptor and relevant Dockerfiles. Then run the command from inside the subdirectory.
@fg-j Ah, that worked
It ran for ~10min or so but then it failed:
❯ jam create-stack --config stack.toml --build-output build.oci --run-output run.oci
Building photon-powershell
Building on linux/amd64
Building base images
Build complete for base images
build: Decorating base image
Adding CNB_* environment variables
Adding io.buildpacks.stack.* labels
Creating cnb user
run: Decorating base image
Adding io.buildpacks.stack.* labels
Creating cnb user
build: Updating image
run: Updating image
Error: Error: No such image: paketo.io/stack/87zgdlj0a5
Usage:
jam create-stack [flags]
Flags:
--build-output string path to output the build image OCI archive (required)
--config string path to a stack descriptor file (required)
-h, --help help for create-stack
--run-output string path to output the run image OCI archive (required)
--secret strings secret to be passed to your Dockerfile
failed to execute: Error: No such image: paketo.io/stack/87zgdlj0a5
@lamw I was able to reproduce the same error you're seeing on my Mac. I think we should file a separate issue at https://github.com/paketo-buildpacks/jam to track this bug, we need to investigate further. I can do that
@lamw Hey, I'm working on a fix for this, but in the meantime a workaround is to use different Dockerfiles for build and run image creation. The change can be as small as just a null RUN echo hi
, but the Dockerfiles need to produce different image SHAs to get around the bug.
To replace our current PowerShell Dockerfile(s) and build process using the new Buildpacks for .NET Core
The use case is for our Infrastructure Event-Driven Automation OSS project called the VMware Event Broker Appliance (VEBA). Users can define a "function" (code) across a number of programming/scripting languages which are then packaged up inside of a container image.
For our PowerShell users, we currently have two container templates:
From these two template images, we have a number of PowerShell and PowerCLI functions that users can quickly and easily use and add their respective PowerShell or PowerCLI code. From that, they can then build a container image that contains their unique function while leveraging the infrastructure that we've built as part of the two base container images, mentioned above.
Ultimately, our goal is to make it easy for our end users to write the minimal amount of PowerShell or PowerCLI code and be able to easily build a container image w/o needing to know about the underlying system that produces the image. Today, users must be a bit versed in constructing the Dockerfile (if they wish to introduce new dependencies/modules) and how it connects to their code (business value)
Easily convert our existing Dockerfile into respective buildpack configuration with good examples that we can follow to migrate away from using
docker
topack
to build our container images.Although the recently released .NET Core Buildpack enables the possibility for supporting PowerShell Core, my understanding is additional code enhancement is required to buildpack to enable our use case and is currently not feasible as an end consumer
Build Configuration
pack
(0.23.0+git-0db2c77.build-3056) and looking to build PowerShell Core Container Images.NET Core
N/A
See above for details