Skip to content

Commit

Permalink
Merge pull request #4 from amirhnajafiz/2-arch-and-os
Browse files Browse the repository at this point in the history
2 arch and os
  • Loading branch information
amirhnajafiz authored Aug 6, 2022
2 parents 66d0f7b + ca02167 commit 0e17926
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions bin/mustache
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,40 @@ if [[ $search != "" && $replace != "" ]]; then
sed -i '' "s/$search/$replace/g" "$WORKING_DIR/build/Dockerfile"
fi

# go os
printf "Which operating system?\n"

goos_options=("aix" "android" "darwin" "dragonfly" "freebsd" "hurd" "illumos" "ios" "js" "linux" "nacl" "netbsd" "openbsd" "plan9" "solaris" "windows" "zos")

select_opt "${goos_options[@]}"
go_os_choice=$?

# shellcheck disable=SC2059
printf "${On_Yellow}Selected Go OS:${color_off} ${green}${goos_options[$go_os_choice]}${color_off}\n"

search="{{GOOS}}"
replace=${goos_options[$go_os_choice]}
if [[ $search != "" && $replace != "" ]]; then
sed -i '' "s/$search/$replace/g" "$WORKING_DIR/build/Dockerfile"
fi

# go arch
printf "Which architecture?\n"

goarch_options=("386" "amd64" "amd64p32" "arm" "arm64" "arm64be" "armbe" "loong64" "mips" "mips64" "mips64le" "mips64p32" "mips64p32le" "mipsle" "ppc" "ppc64" "wasm")

select_opt "${goarch_options[@]}"
goarch_choice=$?

# shellcheck disable=SC2059
printf "${On_Yellow}Selected Go OS:${color_off} ${green}${goarch_options[$goarch_choice]}${color_off}\n"

search="{{GOARCH}}"
replace=${goarch_options[$goarch_choice]}
if [[ $search != "" && $replace != "" ]]; then
sed -i '' "s/$search/$replace/g" "$WORKING_DIR/build/Dockerfile"
fi

# managing docker compose file
DOCKER_COMPOSE="./stubs/docker-compose.yaml"
cp "$DOCKER_COMPOSE" $WORKING_DIR
Expand Down
2 changes: 1 addition & 1 deletion runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN go mod download

# Build the Go app
WORKDIR /app
RUN go build -o /app-runner
RUN GOOS={{GOOS}} GOARCH={{GOARCH}} go build -o /app-runner

# Start the main app
FROM alpine:latest
Expand Down

0 comments on commit 0e17926

Please sign in to comment.