-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,42 @@ | ||
FROM node:19-alpine as frontend | ||
FROM node:18-alpine as frontend | ||
WORKDIR /build | ||
COPY frontend ./frontend | ||
RUN cd frontend && yarn install && yarn build:http | ||
RUN cd frontend && yarn install && yarn build | ||
|
||
FROM golang:1.21 as builder | ||
|
||
ARG TARGETPLATFORM | ||
ARG BUILDPLATFORM | ||
|
||
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" | ||
FROM golang:latest as builder | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y gcc | ||
apt-get install -y gcc | ||
|
||
ENV CGO_ENABLED=1 | ||
ENV GOOS=linux | ||
#ENV GOARCH=$GOARCH | ||
|
||
#RUN echo "AAA $GOARCH" | ||
ENV GOARCH=amd64 | ||
|
||
# Move to working directory /build | ||
WORKDIR /build | ||
|
||
# Copy and download dependency using go mod | ||
COPY go.mod . | ||
COPY go.sum . | ||
RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go mod download | ||
RUN go mod download | ||
|
||
# Copy the code into the container | ||
COPY . . | ||
|
||
# Copy frontend dist files into the container | ||
COPY --from=frontend /build/frontend/dist ./frontend/dist | ||
|
||
RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go build -o main . | ||
|
||
RUN wget https://github.com/breez/breez-sdk-go/raw/main/breez_sdk/lib/linux-amd64/libbreez_sdk_bindings.so | ||
RUN go build -o main . | ||
|
||
# Start a new, final image to reduce size. | ||
FROM debian as final | ||
FROM alpine as final | ||
|
||
# FROM gcr.io/distroless/static-debian11 | ||
|
||
# USER small-user:small-user | ||
|
||
ENV LD_LIBRARY_PATH=/usr/lib/libbreez | ||
# | ||
# # Copy the binaries and entrypoint from the builder image. | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=builder /build/libbreez_sdk_bindings.so /usr/lib/libbreez/ | ||
# Copy the binaries and entrypoint from the builder image. | ||
COPY --from=builder /build/main /bin/ | ||
RUN touch .env | ||
|
||
ENTRYPOINT [ "/bin/main" ] |