Skip to content

Commit

Permalink
fix(bridge): docker build (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVerstraete authored Jun 16, 2023
1 parent ef4ef7d commit e0aae0a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
substrate-node
activation-service
clients/tfchain-client-rs
clients/tfchain-client-js
tools
cli-tool
19 changes: 14 additions & 5 deletions bridge/tfchain_bridge/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
FROM golang:alpine3.14 as BUILDER
WORKDIR /opt/tfchain
COPY . .
WORKDIR /opt/tfchain
RUN go build

WORKDIR /src

ADD bridge/tfchain_bridge /src/bridge/tfchain_bridge
ADD clients/tfchain-client-go /src/clients/tfchain-client-go

WORKDIR /src

RUN cd /src/bridge/tfchain_bridge &&\
CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s -X main.GitCommit=${version} -extldflags '-static'" -o tfchain_bridge &&\
chmod +x tfchain_bridge

FROM alpine:3.13.5
COPY --from=BUILDER /opt/tfchain/tfchain_bridge /bin/

COPY --from=BUILDER /src/bridge/tfchain_bridge/tfchain_bridge /bin/

ENTRYPOINT [ "/bin/tfchain_bridge" ]
5 changes: 4 additions & 1 deletion bridge/tfchain_bridge/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ This is a normal go project so just execute `go build`.

To build a docker image with the latest git tag as version:

Note: this assumes you are in this directory (bridge/tfchain_bridge)

```sh
docker build -t tftchainstellarbridge:$(git describe --abbrev=0 --tags | sed 's/^v//') .
cd ../../
docker build -t tftchainstellarbridge:$(git describe --abbrev=0 --tags | sed 's/^v//') . -f bridge/tfchain_bridge/Dockerfile
```

0 comments on commit e0aae0a

Please sign in to comment.