-
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.
feat:implemented one click installation
- Loading branch information
1 parent
913871b
commit c104ae3
Showing
5 changed files
with
92 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Build stage | ||
FROM golang:1.22 AS builder | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy go.mod and go.sum files to download dependencies | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
# Copy the entire source code into the container | ||
COPY . . | ||
|
||
# Build the Go application | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o myapp . | ||
|
||
# Production stage | ||
FROM alpine:latest | ||
|
||
# Copy the binary from the builder stage | ||
COPY --from=builder /app/myapp . | ||
|
||
# Expose the port on which your app will run | ||
EXPOSE 8080 | ||
|
||
# Command to run the application | ||
CMD ["./myapp"] |
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,37 +1,10 @@ | ||
# version: '3' | ||
# services: | ||
# ftp-server: | ||
# image: stilliard/pure-ftpd | ||
# environment: | ||
# FTP_USER_NAME: testuser | ||
# FTP_USER_PASS: testpass | ||
# FTP_USER_HOME: /home/testuser | ||
# ports: | ||
# - "21:21" | ||
# - "30000-30009:30000-30009" | ||
# volumes: | ||
# - ./ftp-data:/home/testuser # Mounts the local directory to the container | ||
|
||
|
||
services: | ||
jaeger: | ||
image: jaegertracing/all-in-one:1.34 | ||
container_name: jaeger | ||
environment: | ||
- COLLECTOR_ZIPKIN_HTTP_PORT=9411 | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "5775:5775" # Jaeger agent | ||
- "6831:6831/udp" # Jaeger agent (UDP) | ||
- "6832:6832/udp" # Jaeger agent (UDP) | ||
- "5778:5778" # Jaeger UI (HTTP) | ||
- "16686:16686" # Jaeger UI | ||
- "14250:14250" # Jaeger Thrift HTTP | ||
- "14268:14268" # Jaeger Collector HTTP | ||
- "9411:9411" # Zipkin HTTP endpoint | ||
networks: | ||
- jaeger | ||
|
||
networks: | ||
jaeger: | ||
driver: bridge | ||
|
||
- "8080:8080" | ||
volumes: | ||
- .:/app |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
installfractal() { | ||
echo "Installing Fractal..." | ||
|
||
# Clone the repository containing docker-compose.yml | ||
git clone https://github.com/SkySingh04/fractal.git /tmp/fractal || { | ||
echo "Failed to clone the Fractal repository." | ||
exit 1 | ||
} | ||
|
||
cd /tmp/fractal || exit | ||
|
||
echo "Running Docker Compose..." | ||
|
||
# Check if Docker Compose is installed | ||
if ! command -v docker-compose &> /dev/null; then | ||
echo "Docker Compose not found. Please install Docker Compose and try again." | ||
exit 1 | ||
fi | ||
|
||
# Start the app using Docker Compose | ||
docker-compose up -d | ||
|
||
# Create an alias for starting the app with Docker Compose | ||
alias_cmd="alias fractal='cd /tmp/fractal && docker-compose up -d'" | ||
|
||
# Add alias to shell configuration file based on the user's shell | ||
current_shell="$(basename "$SHELL")" | ||
if [[ "$current_shell" == "zsh" ]]; then | ||
if ! grep -q "alias fractal=" "$HOME/.zshrc"; then | ||
echo "$alias_cmd" >> "$HOME/.zshrc" | ||
fi | ||
source "$HOME/.zshrc" | ||
elif [[ "$current_shell" == "bash" ]]; then | ||
if ! grep -q "alias fractal=" "$HOME/.bashrc"; then | ||
echo "$alias_cmd" >> "$HOME/.bashrc" | ||
fi | ||
source "$HOME/.bashrc" | ||
else | ||
if ! grep -q "alias fractal=" "$HOME/.profile"; then | ||
echo "$alias_cmd" >> "$HOME/.profile" | ||
fi | ||
source "$HOME/.profile" | ||
fi | ||
|
||
echo "Alias 'fractal' added! Use 'fractal' to run the app." | ||
} | ||
|
||
installfractal |