-
Notifications
You must be signed in to change notification settings - Fork 15
feat: base img support #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
194e6ef
feat: base img support
rakshitgondwal 7603831
modify gen
rakshitgondwal c2adcb6
build working
rakshitgondwal c4f39df
modify init
rakshitgondwal 0e3fad6
Update README.md
dr-housemd a4816b2
Update discord link
dr-housemd c1e9004
add to oci block
rakshitgondwal eab2db9
remove base and baseDeps
rakshitgondwal cd5f173
modify templating and add oci on init default
rakshitgondwal 5c32f64
modify lock gen
rakshitgondwal 3847420
remove failing ci check
rakshitgondwal 3998411
fix test
rakshitgondwal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -10,31 +10,49 @@ import ( | |
"github.com/buildsafedev/bsf/pkg/langdetect" | ||
) | ||
|
||
func generatehcl2NixConf(pt langdetect.ProjectType, pd *langdetect.ProjectDetails) (hcl2nix.Config, error) { | ||
func generatehcl2NixConf(pt langdetect.ProjectType, pd *langdetect.ProjectDetails) (hcl2nix.Config, bool, error) { | ||
switch pt { | ||
case langdetect.GoModule: | ||
return genGoModuleConf(pd), nil | ||
return genGoModuleConf(pd), false, nil | ||
case langdetect.PythonPoetry: | ||
return genPythonPoetryConf(), nil | ||
return genPythonPoetryConf(), false, nil | ||
case langdetect.RustCargo: | ||
config, err := genRustCargoConf() | ||
if err != nil { | ||
return hcl2nix.Config{}, err | ||
return hcl2nix.Config{}, false, err | ||
} | ||
return config, nil | ||
return config, false, nil | ||
case langdetect.JsNpm: | ||
config, err := genJsNpmConf() | ||
if err != nil { | ||
return hcl2nix.Config{}, err | ||
return hcl2nix.Config{}, false, err | ||
} | ||
return config, nil | ||
return config, false, nil | ||
default: | ||
return hcl2nix.Config{ | ||
Packages: hcl2nix.Packages{}, | ||
}, nil | ||
return generateEmptyConf(), true, nil | ||
} | ||
} | ||
|
||
func generateEmptyConf() hcl2nix.Config { | ||
return hcl2nix.Config{ | ||
Packages: hcl2nix.Packages{ | ||
Development: []string{""}, | ||
Runtime: []string{"[email protected]"}, | ||
}, | ||
OCIArtifact: []hcl2nix.OCIArtifact{ | ||
{ | ||
Artifact: "pkgs", | ||
Name: "bsf-base-image", | ||
Cmd: []string{}, | ||
Entrypoint: []string{}, | ||
EnvVars: []string{}, | ||
ExposedPorts: []string{}, | ||
ImportConfigs: []string{}, | ||
DevDeps: false, | ||
}, | ||
}, | ||
} | ||
} | ||
func genRustCargoConf() (hcl2nix.Config, error) { | ||
content, err := os.ReadFile("Cargo.toml") | ||
if err != nil { | ||
|
@@ -65,6 +83,18 @@ func genRustCargoConf() (hcl2nix.Config, error) { | |
RustVersion: "1.75.0", | ||
Release: true, | ||
}, | ||
OCIArtifact: []hcl2nix.OCIArtifact{ | ||
{ | ||
Artifact: "pkgs", | ||
Name: "bsf-base-image", | ||
Cmd: []string{}, | ||
Entrypoint: []string{}, | ||
EnvVars: []string{}, | ||
ExposedPorts: []string{}, | ||
ImportConfigs: []string{}, | ||
DevDeps: false, | ||
}, | ||
}, | ||
}, nil | ||
} | ||
|
||
|
@@ -83,6 +113,18 @@ func genPythonPoetryConf() hcl2nix.Config { | |
PreferWheels: false, | ||
CheckGroups: []string{"dev"}, | ||
}, | ||
OCIArtifact: []hcl2nix.OCIArtifact{ | ||
{ | ||
Artifact: "pkgs", | ||
Name: "bsf-base-image", | ||
Cmd: []string{}, | ||
Entrypoint: []string{}, | ||
EnvVars: []string{}, | ||
ExposedPorts: []string{}, | ||
ImportConfigs: []string{}, | ||
DevDeps: false, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
|
@@ -106,6 +148,18 @@ func genGoModuleConf(pd *langdetect.ProjectDetails) hcl2nix.Config { | |
Name: name, | ||
SourcePath: entrypoint, | ||
}, | ||
OCIArtifact: []hcl2nix.OCIArtifact{ | ||
{ | ||
Artifact: "pkgs", | ||
Name: "bsf-base-image", | ||
Cmd: []string{}, | ||
Entrypoint: []string{}, | ||
EnvVars: []string{}, | ||
ExposedPorts: []string{}, | ||
ImportConfigs: []string{}, | ||
DevDeps: false, | ||
}, | ||
}, | ||
} | ||
|
||
} | ||
|
@@ -134,5 +188,17 @@ func genJsNpmConf() (hcl2nix.Config, error) { | |
PackageName: name, | ||
PackageRoot: "./.", | ||
}, | ||
OCIArtifact: []hcl2nix.OCIArtifact{ | ||
{ | ||
Artifact: "pkgs", | ||
Name: "bsf-base-image", | ||
Cmd: []string{}, | ||
Entrypoint: []string{}, | ||
EnvVars: []string{}, | ||
ExposedPorts: []string{}, | ||
ImportConfigs: []string{}, | ||
DevDeps: false, | ||
}, | ||
}, | ||
}, nil | ||
} |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.