goexpose
goexpose copied to clipboard
Instructions on local builds?
Can you share a bit more about your build process?
I tried to dockerize this and am getting:
=> ERROR [builder 8/8] RUN echo "Compiling for darwin-amd64..." && glide novendor && env GOOS=darwin GOARCH=amd64 go build -ldflags "-s" -o build/goexpose-darwin-amd64-1.0.0 ./cmd/goexpose 0.3s
------
> [builder 8/8] RUN echo "Compiling for darwin-amd64..." && glide novendor && env GOOS=darwin GOARCH=amd64 go build -ldflags "-s" -o build/goexpose-darwin-amd64-1.0.0 ./cmd/goexpose:
#15 0.153 Compiling for darwin-amd64...
#15 0.244 ./cmd/...
#15 0.244 .
#15 0.253 go: cannot find main module, but found glide.lock in /go/src/app
#15 0.253 to create a module there, run:
#15 0.253 go mod init
------
Heres my Dockerfile
# Build stage
FROM golang:latest as builder
RUN apt-get update && \
apt-get install -y git
WORKDIR /go/src/app
# Install Glide
RUN curl -sL https://github.com/Masterminds/glide/releases/download/v0.13.2/glide-v0.13.2-linux-amd64.tar.gz | tar -xz && \
mv linux-amd64/glide /usr/local/bin/glide
# Copy the source code and Glide files
COPY . .
COPY glide.* ./
# Install the project dependencies
RUN glide install
# Set environment variables
ARG version=1.0.0
# Run the build script
#RUN echo "Compiling for darwin-amd64..." && \
# env GOOS=darwin GOARCH=amd64 go build -ldflags "-s" -o build/goexpose-darwin-amd64-$version ./cmd/goexpose
# Run the build script with Glide
RUN echo "Compiling for darwin-amd64..." && \
glide novendor && \
env GOOS=darwin GOARCH=amd64 go build -ldflags "-s" -o build/goexpose-darwin-amd64-$version ./cmd/goexpose
# Final stage
FROM alpine:latest
WORKDIR /root/
# Copy the binary from the builder stage
COPY --from=builder /go/src/app/build/goexpose-darwin-amd64-$version .
# Add any other necessary setup or runtime dependencies here
# Run the binary
CMD ["./goexpose-darwin-amd64-$version"]
Hi, There is release with precompiled binary. I haven't converted goexpose to modules yet, I started to work on it. I can have a look and provide version that supports modules if necessary. Regards, Peter