realize
realize copied to clipboard
example Docker + realize.yaml?
i was able to get this working in a docker container by specifying all arguments in a CMD as found in #44 but was wondering if anyone had an example of this working with a config file.
There might be a better way, but this is working for me right now for a web api. I'm trying 1.11, but you can use the base image you want. It picks up my .realize.yaml file in the root of my project.
# realize.dockerfile
FROM golang:1.11beta2-alpine3.8
RUN apk --update add git bash build-base && \
rm -rf /var/lib/apt/lists/* && \
rm /var/cache/apk/*
WORKDIR /app
VOLUME /app
RUN go get github.com/oxequa/realize
CMD ["realize", "start"]
$ docker build -t realize:1.11beta2-alpine3.8 -f docker/realize.dockerfile .
$ docker run -it --rm -v ${PWD}:/app -p 8080:8080 realize:1.11beta2-alpine3.8
Hi I tried the above but I am having difficulties with the packages the app imports. @jfcantin Would you specify another volume in the dockerfile to have access to them? (did try the latter without success)
I'm not sure what you are trying to do, but in go 1.11 all missing dependencies are pulled in the go get call.
I have the same problem as @andreacab. Everything works fine if we bind go files with no import or with import of go packages only. Importing some third-party package that I have in my GOPATH produces the following output:
| main.go:4:2: cannot find package "github.com/avast/retry-go" in any of: | /usr/local/go/src/github.com/avast/retry-go (from $GOROOT) | /go/src/github.com/avast/retry-go (from $GOPATH) | exit status 1
Could somebody share workable solution on how to install binded code inside a Docker container provided that the code imports third-party libraries which, it appears, are not inside the container. Maybe we need to run go get command before everything is reinstalled. Does anybody know how to overcome this issue?
I added the "go get" call in the configuration
watcher: scripts: - type: before command: go get global: true output: true - type: before command: go get output: true