Skip to content

Commit

Permalink
Fix dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
infogulch committed Apr 6, 2024
1 parent 361ad02 commit aefa33e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ GITVER="$(git describe --exact-match --tags 2> /dev/null || git rev-parse --shor
VERSION="$(go list -f '{{.Version}}' -m github.com/infogulch/xtemplate@$GITVER)"
LDFLAGS="-X 'github.com/infogulch/xtemplate/app.version=$VERSION'"

GOOS=linux GOARCH=amd64 go build -ldflags="$LDFLAGS" -buildmode exe -o ./dist/xtemplate-amd64-linux/xtemplate ./app/cmd
GOOS=darwin GOARCH=amd64 go build -ldflags="$LDFLAGS" -buildmode exe -o ./dist/xtemplate-amd64-darwin/xtemplate ./app/cmd
GOOS=windows GOARCH=amd64 go build -ldflags="$LDFLAGS" -buildmode exe -o ./dist/xtemplate-amd64-windows/xtemplate.exe ./app/cmd
GOOS=linux GOARCH=amd64 go build -ldflags="$LDFLAGS" -buildmode exe -o ./dist/xtemplate-amd64-linux/xtemplate ./cmd
GOOS=darwin GOARCH=amd64 go build -ldflags="$LDFLAGS" -buildmode exe -o ./dist/xtemplate-amd64-darwin/xtemplate ./cmd
GOOS=windows GOARCH=amd64 go build -ldflags="$LDFLAGS" -buildmode exe -o ./dist/xtemplate-amd64-windows/xtemplate.exe ./cmd

docker build -t "xtemplate:$VERSION" --build-arg LDFLAGS="$LDFLAGS" .

Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ RUN adduser \
--uid "${UID}" \
"${USER}"

WORKDIR /build/app
WORKDIR /build/cmd
COPY go.mod go.sum /build/
COPY app/go.mod app/go.sum /build/app/
COPY cmd/go.mod cmd/go.sum /build/cmd/
COPY providers/nats/go.mod providers/nats/go.sum /build/providers/nats/
RUN go mod download

Expand All @@ -26,7 +27,7 @@ RUN CGO_ENABLED=1 \
GOFLAGS='-tags="sqlite_json"' \
GOOS=linux \
GOARCH=amd64 \
go build -ldflags="${LDFLAGS}" -o /dist/xtemplate ./cmd
go build -ldflags="${LDFLAGS}" -o /dist/xtemplate .
RUN ldd /dist/xtemplate | tr -s [:blank:] '\n' | grep ^/ | xargs -I % install -D % /dist/%
RUN ln -s ld-musl-x86_64.so.1 /dist/lib/libc.musl-x86_64.so.1

Expand All @@ -45,4 +46,4 @@ EXPOSE 80

ENTRYPOINT ["/app/xtemplate"]

CMD ["-template-path", "/app/templates", "-watch-template", "false", "-log", "0", "-listen", ":80"]
CMD ["--template-dir", "./templates", "--watch-templates", "false", "--listen", ":80"]
2 changes: 0 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (

"github.com/alexflint/go-arg"
"github.com/infogulch/watch"

_ "github.com/infogulch/xtemplate/providers"
)

type Args struct {
Expand Down

0 comments on commit aefa33e

Please sign in to comment.