Comments (4)
from docker-events-notifier.
Thanks for the reply.
I've never programmed in go so I don't know how the build process works.
I created the go folder inside my home folder and set the GOPATH environment variable as follows export GOPATH=$HOME/go
and modified the Dockerfile as follows
FROM golang:1.15 as builder
WORKDIR $GOPATH/docker-events-notifier
COPY main.go .
RUN go get -d -v ./...
RUN go install -v ./...
ENV DOCKER_API_VERSION=1.43
ENV RLOG_LOG_LEVEL=WARN
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/bin/docker-events-notifier .
FROM alpine:latest
WORKDIR /etc/docker-events-notifier
COPY templates/ /etc/docker-events-notifier/templates/
COPY --from=builder /go/bin/docker-events-notifier .
When I run the command sudo docker-compose up --build
I get the following error
go install: no install location for directory /go outside GOPATH
For more details see: 'go help gopath'
The command '/bin/sh -c go install -v ./...' returned a non-zero code: 1
ERROR: Service 'docker-events-notifier' failed to build : Build failed
How can I solve it?
from docker-events-notifier.
not a go lang or build expert myself, however did you try keeping the workdir line same?
I think you might be missing only src
before the name. Try like so if keeping the line as-is is troublesome.
WORKDIR $GOPATH/src/docker-events-notifier
btw any exports you do in your cli don't get automatically reflected in docker-compose build
and if envs set in docker-compose file, will only apply to runtime not buildtime.
for envs in build stage, you'll have to use lines like ENV blabla=123
in Dockerfile. exports I think only get applied for one RUN line (when using RUN export...
instead of ENV ...
in Dockerfile).
from docker-events-notifier.
@Tecnomiky
I tried it on a rasberry pi, and all worked ok straight from docker hub
build + runtime were also both ok
docker info
Kernel Version: 6.1.21-v7+
Operating System: Raspbian GNU/Linux 11 (bullseye)
OSType: linux
Architecture: armv7l
CPUs: 4
Total Memory: 922MiB
Docker API version curl --silent --unix-socket /var/run/docker.sock http://x/version
gives me 1.44 API version
{"Platform":{"Name":"Docker Engine - Community"},"Components":[{"Name":"Engine","Version":"25.0.3","Details":{"ApiVersion":"1.44","Arch":"arm","BuildTime":"2024-02-06T21:21:34.000000000+00:00","Experimental":"false","GitCommit":"f417435","GoVersion":"go1.21.6","KernelVersion":"6.1.21-v7+","MinAPIVersion":"1.24","Os":"linux"}},{"Name":"containerd","Version":"1.6.28","Details":{"GitCommit":"ae07eda36dd25f8a1b98dfbf587313b99c0190bb"}},{"Name":"runc","Version":"1.1.12","Details":{"GitCommit":"v1.1.12-0-g51d5e94"}},{"Name":"docker-init","Version":"0.19.0","Details":{"GitCommit":"de40ad0"}}],"Version":"25.0.3","ApiVersion":"1.44","MinAPIVersion":"1.24","GitCommit":"f417435","GoVersion":"go1.21.6","Os":"linux","Arch":"arm","KernelVersion":"6.1.21-v7+","BuildTime":"2024-02-06T21:21:34.000000000+00:00"}
from docker-events-notifier.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-events-notifier.