Skip to content

Commit

Permalink
Merge pull request #43 from funkybunch/ARM-dependency-fix
Browse files Browse the repository at this point in the history
JRE Dependency Fix + Port Configuration
  • Loading branch information
Bernhard B committed Nov 23, 2020
2 parents 12a16c3 + 57665c4 commit c01abfa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ COPY src/go.sum /tmp/signal-cli-rest-api-src/
RUN cd /tmp/signal-cli-rest-api-src && swag init && go build

# Start a fresh container for release container
FROM adoptopenjdk:11-jre-hotspot
FROM adoptopenjdk:11-jdk-hotspot-bionic

COPY --from=buildcontainer /tmp/signal-cli-rest-api-src/signal-cli-rest-api /usr/bin/signal-cli-rest-api
COPY --from=buildcontainer /tmp/signal-cli /opt/signal-cli
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ version: "3"
services:
signal-cli-rest-api:
build: "."
environment:
- PORT=8080
ports:
- "8080:8080" #map docker port 8080 to host port 8080.
volumes:
Expand Down
12 changes: 11 additions & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"os"

"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -85,8 +86,17 @@ func main() {
}
}

swaggerUrl := ginSwagger.URL("http://127.0.0.1:8080/swagger/doc.json")
swaggerPort := getEnv("PORT", "8080")

swaggerUrl := ginSwagger.URL("http://127.0.0.1:" + string(swaggerPort) + "/swagger/doc.json")
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, swaggerUrl))

router.Run()
}

func getEnv(key string, defaultVal string) string {
if value, exists := os.LookupEnv(key); exists {
return value
}
return defaultVal
}

0 comments on commit c01abfa

Please sign in to comment.