Skip to content

Commit

Permalink
fixed Dockerfile, fixed goreleaser. Jumped to 3 digits version (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovikov authored Oct 19, 2022
1 parent 70624b5 commit ded3ac8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 30 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.58"
const Version = "heplify-server 1.59.1"

var Setting HeplifyServer

Expand Down
18 changes: 7 additions & 11 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

FROM golang:alpine as builder

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

RUN go get -u -d -v github.com/sipcapture/heplify-server/...
WORKDIR /go/src/github.com/sipcapture/heplify-server/cmd/heplify-server/
RUN CGO_ENABLED=1 GOOS=linux go build -a --ldflags '-linkmode external -extldflags "-static -s -w"' -o heplify-server .
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

FROM alpine:latest

Expand All @@ -19,5 +15,5 @@ RUN apk --no-cache add ca-certificates
RUN apk upgrade

WORKDIR /root/
COPY --from=builder /go/src/github.com/sipcapture/heplify-server/cmd/heplify-server/heplify-server .
COPY --from=builder /go/src/github.com/sipcapture/heplify-server/scripts ./scripts
COPY --from=builder /go/bin/heplify-server .
COPY --from=builder /go/pkg/mod/github.com/sipcapture/heplify-server@latest/scripts ./scripts
26 changes: 10 additions & 16 deletions example/heplify-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,13 @@ description: |
vendor: "QXIP"
homepage: "http://qxip.net"
license: "AGPLv3"
bindir: "/usr/local/bin"
files:
/tmp/pkg/heplify-server: "/usr/local/bin/heplify-server"
config_files:
/tmp/pkg/example/heplify-server.service: "/lib/systemd/system/heplify-server.service"
/tmp/pkg/example/homer7_config/heplify-server.toml: "/etc/heplify-server.toml"
#overrides:
# rpm:
# scripts:
# preinstall: ./scripts/preinstall.sh
# postremove: ./scripts/postremove.sh
# deb:
# scripts:
# postinstall: ./scripts/postinstall.sh
# preremove: ./scripts/preremove.sh

contents:
# Basic file that applies to all packagers
- src: /tmp/pkg/heplify-server
dst: /usr/local/bin/heplify-server
# Simple config file
- src: /tmp/pkg/example/heplify-server.service
dst: /lib/systemd/system/heplify-server.service
- src: /tmp/pkg/example/homer7_config/heplify-server.toml
dst: /etc/heplify-server.toml
type: config
3 changes: 1 addition & 2 deletions scripts/build_package.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

VERSION=$($PWD/heplify-server --version | grep "VERSION:" | grep -Po '\d.\d+')
VERSION=$($PWD/heplify-server --version | grep "VERSION:" | grep -Po '\d.\d+.\d+')
PACKAGE=${PACKAGE:-"heplify-server"}
RELEASE=${VERSION:-"1.1.4"}
ARCH=${ARCH:-"amd64"}
Expand All @@ -25,4 +25,3 @@ docker run --rm \
-v $PWD:/tmp/pkg \
-e VERSION="$RELEASE" \
goreleaser/nfpm pkg --config /tmp/pkg/example/$PACKAGE.yaml --target "/tmp/pkg/$PACKAGE-$RELEASE-$ARCH.$EXT"

0 comments on commit ded3ac8

Please sign in to comment.