Skip to content

Commit f05a1de

Browse files
authored
fixed static compilation of docker file (#508)
1 parent ded3ac8 commit f05a1de

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

config/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package config
22

3-
const Version = "heplify-server 1.59.1"
3+
const Version = "heplify-server 1.59.2"
44

55
var Setting HeplifyServer
66

docker/Dockerfile

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
# sudo docker build -t sipcapture/heplify-server:latest .
2-
1+
# should be run from root directory of heplify-server
2+
# sudo docker build --no-cache -t sipcapture/heplify-server -f docker/Dockerfile .
33
FROM golang:alpine as builder
44

5-
RUN apk update && apk add --no-cache git build-base luajit-dev
6-
RUN go install github.com/sipcapture/heplify-server/cmd/heplify-server@latest
7-
#workaround for latest version
8-
WORKDIR /go/pkg/mod/github.com/sipcapture/
9-
RUN ln -s `ls -ltd hepl* | tail -1 | awk '{print $9}'` heplify-server@latest
5+
RUN apk update && apk add --no-cache git build-base
6+
RUN git clone https://luajit.org/git/luajit-2.0.git \
7+
&& cd luajit-2.0 \
8+
&& make CCOPT="-static -fPIC" BUILDMODE="static" && make install
9+
COPY . /heplify-server
10+
WORKDIR /heplify-server/cmd/heplify-server
11+
RUN CGO_ENABLED=1 GOOS=linux go build -a --ldflags '-linkmode external -extldflags "-static -s -w"' -o heplify-server .
1012

1113
FROM alpine:latest
1214

1315
RUN apk update
14-
RUN apk --no-cache add ca-certificates
16+
RUN apk --no-cache add ca-certificates bash
1517
RUN apk upgrade
1618

1719
WORKDIR /root/
18-
COPY --from=builder /go/bin/heplify-server .
19-
COPY --from=builder /go/pkg/mod/github.com/sipcapture/heplify-server@latest/scripts ./scripts
20+
COPY --from=builder /heplify-server/cmd/heplify-server/heplify-server .
21+
COPY --from=builder /heplify-server/scripts ./scripts

0 commit comments

Comments
 (0)