Skip to content

Commit

Permalink
fixed static compilation of docker file (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovikov authored Oct 20, 2022
1 parent ded3ac8 commit f05a1de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package config

const Version = "heplify-server 1.59.1"
const Version = "heplify-server 1.59.2"

var Setting HeplifyServer

Expand Down
22 changes: 12 additions & 10 deletions docker/Dockerfile
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

0 comments on commit f05a1de

Please sign in to comment.