Skip to content

Commit

Permalink
fetch golang package during docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
clems4ever authored and manu-ns committed Jan 6, 2022
1 parent 9352137 commit a612fe5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ FROM golang:1.17

# Using root user creates permission issues on the host, particularly with go.sum being regenerated within the container.
RUN useradd -s /bin/bash -m -U dev
USER dev

RUN go get github.com/cespare/reflex
RUN go install github.com/go-delve/delve/cmd/[email protected]
RUN go install github.com/cespare/[email protected]

WORKDIR /usr/app
ADD go.mod go.mod
ADD go.sum go.sum
RUN go mod download
RUN chown -R dev /usr/app

USER dev

ENTRYPOINT ["/scripts/entrypoint.sh"]
2 changes: 0 additions & 2 deletions resources/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

set -x

go get github.com/go-delve/delve/cmd/dlv

reflex -r '(\.go$|go\.mod|\.sh|\.yaml|\.yml)' -s -- $*
16 changes: 13 additions & 3 deletions resources/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!/bin/bash

echo "Running agent along with dlv debugging server"
/scripts/run-with-debug.sh haproxy-spoe-auth cmd/haproxy-spoe-auth/main.go -- \
-config /configuration/config.yml \
if [[ "$DEBUG_ENABLED" -eq "1" ]]
then
echo "Running agent along with debug server"
/scripts/run-with-debug.sh haproxy-spoe-auth cmd/haproxy-spoe-auth/main.go -- \
-config /configuration/config.yml
else
while true
do
echo "Running agent without debug server"
go run cmd/haproxy-spoe-auth/main.go -config /configuration/config.yml
sleep 2
done
fi

0 comments on commit a612fe5

Please sign in to comment.