-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit a98ee3d.
- Loading branch information
Showing
4 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
## Build Stages: | ||
# system = prepares the "OS" by downloading required binaries | ||
# get-dependencies = downloads the go modules using the prepared system | ||
# build-wallet = copies over the source code and builds the binaries using a compiler cache | ||
# final = copies over only the executables in an alpine image that doesn't have any additional load. | ||
|
||
FROM golang:1.22.1-alpine3.19 as system | ||
|
||
# set the base libs to build / run | ||
RUN apk add build-base bash git | ||
ENV CGO_ENABLED=1 | ||
ARG TESTNET_TYPE | ||
|
||
# Standard build stage that initializes the go dependencies | ||
FROM system as get-dependencies | ||
# create the base directory | ||
# setup container data structure | ||
RUN mkdir -p /home/obscuro/go-obscuro | ||
|
||
|
||
# Ensures container layer caching when dependencies are not changed | ||
WORKDIR /home/obscuro/go-obscuro | ||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
# Build stage that will create a wallet extension executable | ||
FROM get-dependencies as build-wallet | ||
# make sure the geth network code is available | ||
COPY . /home/obscuro/go-obscuro | ||
|
||
# build the gateway executable | ||
WORKDIR /home/obscuro/go-obscuro/tools/walletextension/main | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
go build -o ../bin/wallet_extension_linux | ||
|
||
# Lightweight final build stage. Includes bare minimum to start wallet extension | ||
FROM alpine:3.18 | ||
|
||
# copy over the gateway executable | ||
COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/bin /home/obscuro/go-obscuro/tools/walletextension/bin | ||
|
||
# copy over the .sql migration files | ||
COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/storage/database /home/obscuro/go-obscuro/tools/walletextension/storage/database | ||
|
||
# copy over the entrypoint script | ||
COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|