-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccf176e
commit 2d775b0
Showing
11 changed files
with
211 additions
and
48 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
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
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
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
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
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,11 +1,18 @@ | ||
package plan | ||
|
||
const ( | ||
CacheTypeShared = "shared" | ||
CacheTypeLocked = "locked" | ||
) | ||
|
||
type Cache struct { | ||
Directory string `json:"directory,omitempty"` | ||
Type string `json:"type,omitempty"` | ||
} | ||
|
||
func NewCache(directory string) *Cache { | ||
return &Cache{ | ||
Directory: directory, | ||
Type: CacheTypeShared, | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package php | ||
|
||
import ( | ||
"github.com/railwayapp/railpack-go/core/generate" | ||
) | ||
|
||
const ( | ||
DEFAULT_PHP_VERSION = "8.4" | ||
) | ||
|
||
type PhpProvider struct{} | ||
|
||
func (p *PhpProvider) Name() string { | ||
return "php" | ||
} | ||
|
||
func (p *PhpProvider) Plan(ctx *generate.GenerateContext) (bool, error) { | ||
hasPhp := ctx.App.HasMatch("index.php") || | ||
ctx.App.HasMatch("composer.json") | ||
|
||
if !hasPhp { | ||
return false, nil | ||
} | ||
|
||
if err := p.packages(ctx); err != nil { | ||
return false, err | ||
} | ||
|
||
ctx.Start.Paths = append(ctx.Start.Paths, ".") | ||
|
||
return false, nil | ||
} | ||
|
||
var runtimeAptPackages = []string{ | ||
"libgd-dev", | ||
"libedit-dev", | ||
"libicu-dev", | ||
"libjpeg-dev", | ||
"libmysqlclient-dev", | ||
"libonig-dev", | ||
"libpng-dev", | ||
"libpq-dev", | ||
"libreadline-dev", | ||
"libsqlite3-dev", | ||
"libssl-dev", | ||
"libxml2-dev", | ||
"libzip-dev", | ||
"openssl", | ||
"libcurl4-openssl-dev", | ||
} | ||
|
||
// These packages (+ runtime) are only needed for building php | ||
// They are not included at runtime | ||
var buildAptPackages = []string{ | ||
"gettext", | ||
"curl", | ||
"git", | ||
"autoconf", | ||
"build-essential", | ||
"bison", | ||
"pkg-config", | ||
"zlib1g-dev", | ||
"re2c", | ||
} | ||
|
||
func (p *PhpProvider) packages(ctx *generate.GenerateContext) error { | ||
packages := ctx.NewPackageStep("packages") | ||
packages.Default("php", DEFAULT_PHP_VERSION) | ||
packages.SupportingAptPackages = runtimeAptPackages | ||
packages.SupportingAptPackages = append(packages.SupportingAptPackages, buildAptPackages...) | ||
|
||
runtimePackages := ctx.NewPackageStep("packages:runtime") | ||
runtimePackages.SupportingAptPackages = runtimeAptPackages | ||
runtimePackages.Outputs = []string{"/"} | ||
|
||
return nil | ||
} |
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
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Hello World!</title> | ||
<style> | ||
@import url('https://fonts.bunny.net/css2?family=Nunito&display=swap'); | ||
body { | ||
background-color: rgb(245, 234, 214); | ||
font-family: Nunito; | ||
font-size: large; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
height: 100vh; | ||
text-align: center; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
a { | ||
color: #dd5500; | ||
text-decoration: none; | ||
transition-property: all; | ||
transition-duration: .2s; | ||
padding-bottom: 0px; | ||
border-bottom: 0px solid transparent; | ||
} | ||
a:hover { | ||
border-bottom-width: 2px; | ||
border-bottom-color: #dd5500; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div> | ||
<h1>Hello World!</h1> | ||
<p>Welcome to <a href="https://github.com/railwayapp/railpack">Railpack</a>!</p> | ||
<p><b>PHP Version:</b> <?php echo phpversion() ?></p> | ||
</div> | ||
</body> | ||
</html> |