Add support for php 8.1

This commit adds optional support for basing images on php 8.1 as
opposed to php 8.0.
This commit is contained in:
Tom Wiesing 2023-06-29 11:05:40 +02:00 committed by Tom
parent 3ef9c23a0c
commit d114c8fafe
12 changed files with 91 additions and 9 deletions

View file

@ -22,11 +22,27 @@ type Provision struct {
// ProvisionFlags are flags for a new instance
type ProvisionFlags struct {
// Slug is the slug of the wisski instance
Slug string
// PHP Version to use
PHPVersion string
}
var ErrInstanceAlreadyExists = errors.New("instance with provided slug already exists")
func (pv *Provision) ValidateFlags(flags ProvisionFlags) error {
// check the slug
if _, err := pv.Dependencies.Instances.IsValidSlug(flags.Slug); err != nil {
return err
}
// check for known php versions
if _, err := instances.GetBaseImage(flags.PHPVersion); err != nil {
return err
}
return nil
}
// Provision provisions a new docker compose instance.
func (pv *Provision) Provision(progress io.Writer, ctx context.Context, flags ProvisionFlags) (*wisski.WissKI, error) {
// check that it doesn't already exist
@ -36,7 +52,7 @@ func (pv *Provision) Provision(progress io.Writer, ctx context.Context, flags Pr
}
// make it in-memory
instance, err := pv.Dependencies.Instances.Create(flags.Slug)
instance, err := pv.Dependencies.Instances.Create(flags.Slug, flags.PHPVersion)
if err != nil {
return nil, err
}