Skip to content

Commit

Permalink
Updated conditional RUN command in Dockerfile for app, autoconfigure …
Browse files Browse the repository at this point in the history
…and net_http
  • Loading branch information
nickpaisley committed Feb 7, 2024
1 parent 7df93c1 commit b5af86f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion features/fixtures/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV GOPATH /app
COPY testbuild /app/src/github.com/bugsnag/bugsnag-go
WORKDIR /app/src/github.com/bugsnag/bugsnag-go/v2

# RUN go get ./...
# A conditional call to run go get or go install based on the go version
RUN GO_VERSION=$(go version | cut -d " " -f3 | sed 's/go//') && \
if [[ $(echo -e "1.11\n$GO_VERSION\n1.16" | sort -V | head -2 | tail -1) == "$GO_VERSION" ]]; then \
echo "Version is between 1.11 and 1.16, running go get"; \
Expand Down
11 changes: 9 additions & 2 deletions features/fixtures/autoconfigure/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ ENV GOPATH /app
COPY testbuild /app/src/github.com/bugsnag/bugsnag-go
WORKDIR /app/src/github.com/bugsnag/bugsnag-go/v2

# Get bugsnag dependencies
RUN go get ./...
# Get bugsnag dependencies using a conditional call to run go get or go install based on the go version
RUN GO_VERSION=$(go version | cut -d " " -f3 | sed 's/go//') && \
if [[ $(echo -e "1.11\n$GO_VERSION\n1.16" | sort -V | head -2 | tail -1) == "$GO_VERSION" ]]; then \
echo "Version is between 1.11 and 1.16, running go get"; \
go get ./...; \
else \
echo "Version is greater than 1.16, running go install"; \
go install ./...; \
fi

# Copy test scenarios
COPY ./autoconfigure /app/src/test
Expand Down
11 changes: 9 additions & 2 deletions features/fixtures/net_http/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ ENV GOPATH /app
COPY testbuild /app/src/github.com/bugsnag/bugsnag-go
WORKDIR /app/src/github.com/bugsnag/bugsnag-go/v2

# Get bugsnag dependencies
RUN go get ./...
# Get bugsnag dependencies using a conditional call to run go get or go install based on the go version
RUN GO_VERSION=$(go version | cut -d " " -f3 | sed 's/go//') && \
if [[ $(echo -e "1.11\n$GO_VERSION\n1.16" | sort -V | head -2 | tail -1) == "$GO_VERSION" ]]; then \
echo "Version is between 1.11 and 1.16, running go get"; \
go get ./...; \
else \
echo "Version is greater than 1.16, running go install"; \
go install ./...; \
fi

# Copy test scenarios
COPY ./net_http /app/src/test
Expand Down

0 comments on commit b5af86f

Please sign in to comment.