-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed static compilation of docker file (#508)
- Loading branch information
1 parent
ded3ac8
commit f05a1de
Showing
2 changed files
with
13 additions
and
11 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
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,19 +1,21 @@ | ||
# sudo docker build -t sipcapture/heplify-server:latest . | ||
|
||
# should be run from root directory of heplify-server | ||
# sudo docker build --no-cache -t sipcapture/heplify-server -f docker/Dockerfile . | ||
FROM golang:alpine as builder | ||
|
||
RUN apk update && apk add --no-cache git build-base luajit-dev | ||
RUN go install github.com/sipcapture/heplify-server/cmd/heplify-server@latest | ||
#workaround for latest version | ||
WORKDIR /go/pkg/mod/github.com/sipcapture/ | ||
RUN ln -s `ls -ltd hepl* | tail -1 | awk '{print $9}'` heplify-server@latest | ||
RUN apk update && apk add --no-cache git build-base | ||
RUN git clone https://luajit.org/git/luajit-2.0.git \ | ||
&& cd luajit-2.0 \ | ||
&& make CCOPT="-static -fPIC" BUILDMODE="static" && make install | ||
COPY . /heplify-server | ||
WORKDIR /heplify-server/cmd/heplify-server | ||
RUN CGO_ENABLED=1 GOOS=linux go build -a --ldflags '-linkmode external -extldflags "-static -s -w"' -o heplify-server . | ||
|
||
FROM alpine:latest | ||
|
||
RUN apk update | ||
RUN apk --no-cache add ca-certificates | ||
RUN apk --no-cache add ca-certificates bash | ||
RUN apk upgrade | ||
|
||
WORKDIR /root/ | ||
COPY --from=builder /go/bin/heplify-server . | ||
COPY --from=builder /go/pkg/mod/github.com/sipcapture/heplify-server@latest/scripts ./scripts | ||
COPY --from=builder /heplify-server/cmd/heplify-server/heplify-server . | ||
COPY --from=builder /heplify-server/scripts ./scripts |