I’m trying to build Temporalite into a Docker Image. My first attempt for a Docker file looked like so:
FROM public.ecr.aws/docker/library/golang:1.18 AS builder
RUN go install github.com/temporalio/temporalite/cmd/temporalite@latest
FROM public.ecr.aws/docker/library/alpine:3.16
RUN apk update && \
apk upgrade && \
apk add bash
COPY --from=builder ${GOPATH:-/go}/bin/temporalite /
EXPOSE 7233 8233
ENTRYPOINT ["/temporalite", "start", "--ephemeral", "-n", "default", "--ip" , "0.0.0.0"]
But the go install
command fails with:
------
> [builder 2/2] RUN go install github.com/temporalio/temporalite/cmd/temporalite@latest:
#8 0.273 go: downloading github.com/temporalio/temporalite v0.2.0
#8 0.291 go: github.com/temporalio/temporalite/cmd/temporalite@latest (in github.com/temporalio/temporalite@v0.2.0):
#8 0.291 The go.mod file for the module providing named packages contains one or
#8 0.291 more replace directives. It must not contain directives that would cause
#8 0.291 it to be interpreted differently than if it were the main module.
------
So brute forcing it, I changed to this…
FROM public.ecr.aws/docker/library/golang:1.18 AS builder
WORKDIR ${GOPATH:-/go}/src/temporalite
RUN mkdir -p ${GOPATH:-/go}/src/temporalite && \
git clone https://github.com/temporalio/temporalite.git ${GOPATH:-/go}/src/temporalite && \
cd ${GOPATH:-/go}/src/temporalite && \
git checkout v0.2.0 && \
go mod download && \
go get -d -v ./... && \
go build -o ${GOPATH:-/go}/bin/ ${GOPATH:-/go}/src/temporalite/cmd/temporalite
FROM public.ecr.aws/docker/library/alpine:3.16
RUN apk update && \
apk upgrade && \
apk add bash
COPY --from=builder ${GOPATH:-/go}/bin/temporalite /bin
EXPOSE 7233 8233
ENTRYPOINT ["/bin/temporalite", "start", "--ephemeral", "-n", "default", "--ip" , "0.0.0.0"]
Which does build fine. But when I do:
docker run temporal-test:latest
I get:
exec /bin/temporalite: no such file or directory
But when I load up a bash shell:
docker run -it --entrypoint "/bin/bash" temporal-test:latest
bash-5.1# pwd
/
bash-5.1# ls /bin/temporalite
/bin/temporalite
bash-5.1# pwd
/
bash-5.1# ls -l /bin/temporalite
-rwxr-xr-x 1 root root 99799868 Oct 4 19:13 /bin/temporalite
bash-5.1# stat /bin/temporalite
File: /bin/temporalite
Size: 99799868 Blocks: 194928 IO Block: 4096 regular file
Device: 96h/150d Inode: 11937350 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2022-10-04 19:13:38.313498001 +0000
Modify: 2022-10-04 19:13:37.618498001 +0000
Change: 2022-10-04 19:13:38.250498001 +0000
bash-5.1# file /bin/temporalite
/bin/temporalite: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, Go BuildID=7NlJoBFjKDFLgqGcI8_U/NzYsDgYA9a9P2aIwVSCA/7vwHNlTp-roUhrIaQInb/mg2aFR1lwF-vtmn-kK2h, not stripped
bash-5.1# arch
aarch64
The file exists, but it won’t execute. And architectures are the same.
This one has me stumped.