-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from sakan811/feat/build-exe
feat: build executable files with GO
- Loading branch information
Showing
5 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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,46 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
) | ||
|
||
// checkDockerRunning checks if Docker is running | ||
func checkDockerRunning() bool { | ||
cmd := exec.Command("docker", "info") | ||
err := cmd.Run() | ||
return err == nil // Return true if no error, meaning Docker is running | ||
} | ||
|
||
func waitForUser() { | ||
fmt.Println("Press 'Enter' to exit...") | ||
fmt.Scanln() // Wait for user input | ||
} | ||
|
||
func main() { | ||
// Check if Docker is running | ||
if !checkDockerRunning() { | ||
fmt.Println("Error: Docker is not running. Please start Docker Desktop.") | ||
waitForUser() // Keeps the terminal open | ||
os.Exit(1) | ||
} | ||
|
||
// Run docker-compose in detached mode (-d flag) | ||
cmd := exec.Command("docker-compose", "up", "-d") | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
cmd.Dir = "./" | ||
|
||
err := cmd.Run() | ||
if err != nil { | ||
fmt.Printf("Error: %v\n", err) | ||
waitForUser() // Keeps the terminal open | ||
os.Exit(1) | ||
} | ||
|
||
fmt.Println("Please navigate to \033[34mhttp://localhost:5000/\033[0m to access the web-app.") | ||
|
||
fmt.Println("Docker containers are running in detached mode.") | ||
waitForUser() // Wait for the user before closing the terminal | ||
} |
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,3 @@ | ||
module find-place-web-app | ||
|
||
go 1.23.1 |