-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update docker image for better caching #115
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# Built by Akito | ||
# npub1wprtv89px7z2ut04vvquscpmyfuzvcxttwy2csvla5lvwyj807qqz5aqle | ||
|
||
FROM alpine:3.18.3 AS build | ||
|
||
ENV TZ=Europe/London | ||
|
||
WORKDIR /build | ||
|
||
COPY . . | ||
# Runtime dependencies | ||
FROM alpine:3.18.3 AS runtime-deps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can update to |
||
RUN apk --no-cache update && apk --no-cache add \ | ||
lmdb \ | ||
flatbuffers \ | ||
libsecp256k1 \ | ||
libb2 \ | ||
zstd \ | ||
libressl | ||
|
||
RUN \ | ||
apk --no-cache add \ | ||
# Build dependencies | ||
FROM runtime-deps AS build-deps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. avoid repeating the image and avoid redownloading the dependencies |
||
RUN apk update && apk add \ | ||
linux-headers \ | ||
git \ | ||
g++ \ | ||
|
@@ -24,25 +24,24 @@ RUN \ | |
lmdb-dev \ | ||
flatbuffers-dev \ | ||
libsecp256k1-dev \ | ||
zstd-dev \ | ||
&& rm -rf /var/cache/apk/* \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we already have
and
btw, the Ubuntu one is a lot bigger:
|
||
&& git submodule update --init \ | ||
&& make setup-golpe \ | ||
&& make -j4 | ||
zstd-dev | ||
|
||
FROM alpine:3.18.3 | ||
# Stage 1: Build the application using the build-deps base image | ||
FROM build-deps AS build | ||
|
||
WORKDIR /app | ||
WORKDIR /build | ||
|
||
RUN \ | ||
apk --no-cache add \ | ||
lmdb \ | ||
flatbuffers \ | ||
libsecp256k1 \ | ||
libb2 \ | ||
zstd \ | ||
libressl \ | ||
&& rm -rf /var/cache/apk/* | ||
COPY . . | ||
|
||
RUN make clean \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clean was added to the runtime to avoid reusing the local build artefacts |
||
&& git submodule update --init \ | ||
&& make setup-golpe \ | ||
&& make -j4 | ||
|
||
# Stage 2: Create the final runtime image using the runtime-deps base image | ||
FROM runtime-deps AS runtime | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=build /build/strfry strfry | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,15 +35,15 @@ A C++20 compiler is required, along with a few other common dependencies. On Deb | |
git clone https://github.com/hoytech/strfry && cd strfry/ | ||
git submodule update --init | ||
make setup-golpe | ||
make -j4 | ||
make -j$(nproc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should be able to use all processors when not in a docker image |
||
|
||
#### FreeBSD | ||
|
||
pkg install -y gcc gmake cmake git perl5 openssl lmdb flatbuffers libuv libinotify zstr secp256k1 zlib-ng | ||
git clone https://github.com/hoytech/strfry && cd strfry/ | ||
git submodule update --init | ||
gmake setup-golpe | ||
gmake -j4 | ||
gmake -j$(sysctl -n hw.ncpu) | ||
|
||
|
||
### Running a relay | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM ubuntu:jammy as build | ||
FROM ubuntu:jammy AS build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to silence the warning |
||
ENV TZ=Europe/London | ||
WORKDIR /build | ||
RUN apt update && apt install -y --no-install-recommends \ | ||
|
@@ -12,7 +12,7 @@ RUN make setup-golpe | |
RUN make clean | ||
RUN make -j4 | ||
|
||
FROM ubuntu:jammy as runner | ||
FROM ubuntu:jammy AS runner | ||
WORKDIR /app | ||
|
||
RUN apt update && apt install -y --no-install-recommends \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this necessarry, isn't UTC the default?