add redis and executor services into docker-compose files#12
add redis and executor services into docker-compose files#12
Conversation
Dockerfile
Outdated
|
|
||
|
|
||
| FROM python3.12-slim | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # entrypoint lets us pipe stdin and returns stdout | ||
|
|
||
| ENTRYPOINT ["python", "/code/solution.py"] |
There was a problem hiding this comment.
this stuff should be in its own file Dockerfile.python since the runner is a separate service from the Go backend
docker-compose.yml
Outdated
| retries: 5 | ||
| executor: | ||
| build: | ||
| context: ./executor |
There was a problem hiding this comment.
| context: ./executor | |
| context: . |
typo in the issue
docker-compose.dev.yml
Outdated
| executor: | ||
| # docker can only access files in /executor | ||
| build: | ||
| context: ./executor |
There was a problem hiding this comment.
| context: ./executor | |
| context: . |
typo in the issue
adarshm11
left a comment
There was a problem hiding this comment.
also create a new Dockerfile for building and running the executor service, assume this is at cmd/runner/main.go and is done like any normal Go service. then this Dockerfile.executor can be referenced in the docker-compose as how to run the executor service
docker/Dockerfile.python
Outdated
|
|
||
| WORKDIR /app | ||
|
|
||
| # entrypoint lets us pipe stdin and returns stdout | ||
|
|
||
| ENTRYPOINT ["python", "/code/solution.py"] No newline at end of file |
There was a problem hiding this comment.
all of this stuff will be invoked by the Go service when queried, all this file needs to have is the image line
Dockerfile.executor
Outdated
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY --from=build /app/runner /app/runner |
There was a problem hiding this comment.
we also wanna copy everything from docker/ into this so the executor has access to the language images
Dockerfile.executor
Outdated
| WORKDIR /app | ||
|
|
||
| # copy two dependency files for main.go into ./ inside the container aka /app | ||
| COPY cmd/runner/go.mod cmd/runner/go.sum ./ |
There was a problem hiding this comment.
there should only be a go.mod and go.sum in the root directory, so those should be the ones copied. these files won't exist in /cmd/runner
Dockerfile.executor
Outdated
| RUN go mod download | ||
|
|
||
| # copy source code (left) into image (right) | ||
| COPY cmd/runner/ . |
There was a problem hiding this comment.
since cmd/runner/main.go may import other parts of the project, we may need more context than just that file. so let's copy the entire source tree (COPY . . ) and then build the binary using RUN go build -o runner ./cmd/runner
Dockerfile.executor
Outdated
| WORKDIR /app | ||
|
|
||
| COPY --from=build /app/runner /app/runner | ||
|
|
There was a problem hiding this comment.
make sure to expose a port to run this on!
for numba 1 in issue #11. tbh how do you even test dis.