-
Notifications
You must be signed in to change notification settings - Fork 456
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
build: tidy dockerfile #1477
build: tidy dockerfile #1477
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,5 +1,54 @@ | ||
**/.git | ||
**/.gitignore | ||
**/.github | ||
**/tests | ||
Dockerfile | ||
/.git | ||
/.gitignore | ||
/.github | ||
/tests | ||
/Dockerfile | ||
|
||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
*.pyc | ||
*.swp | ||
*.swo | ||
.DS_Store | ||
version.h | ||
|
||
.idea | ||
.vscode | ||
.cache | ||
|
||
compactdb | ||
testdb | ||
|
||
build | ||
cmake-build-* |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,6 @@ FROM alpine:3.16 as build | |
|
||
ARG MORE_BUILD_ARGS | ||
|
||
# workaround tzdata install hanging | ||
ENV TZ=Etc/UTC | ||
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. After switching to Alpine, we don't need this trick. |
||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN apk update && apk add git gcc g++ make cmake ninja autoconf automake libtool python3 linux-headers curl openssl-dev libexecinfo-dev redis | ||
WORKDIR /kvrocks | ||
|
||
|
@@ -31,36 +27,23 @@ RUN ./x.py build -DENABLE_OPENSSL=ON -DPORTABLE=ON -DCMAKE_BUILD_TYPE=Release -j | |
|
||
FROM alpine:3.16 | ||
|
||
ENV TZ=Etc/UTC | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN apk upgrade && apk add libexecinfo | ||
|
||
WORKDIR /kvrocks | ||
|
||
RUN mkdir /var/run/kvrocks && mkdir /var/lib/kvrocks | ||
|
||
RUN addgroup -S kvrocks && adduser -D -H -S -G kvrocks kvrocks | ||
|
||
RUN chown kvrocks:kvrocks /var/run/kvrocks && chown kvrocks:kvrocks /var/lib/kvrocks | ||
|
||
USER kvrocks | ||
|
||
COPY --from=build /kvrocks/build/kvrocks ./bin/ | ||
COPY --from=build /usr/bin/redis-cli ./bin/ | ||
|
||
HEALTHCHECK --interval=10s --timeout=1s --start-period=30s --retries=3 CMD ./bin/redis-cli -p 6666 PING | grep -E '(PONG|NOAUTH)' || exit 1 | ||
|
||
ENV PATH="$PATH:/kvrocks/bin" | ||
|
||
VOLUME /var/lib/kvrocks | ||
|
||
RUN chown kvrocks:kvrocks /var/lib/kvrocks | ||
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. Duplicated above. |
||
COPY --from=build /kvrocks/build/kvrocks /bin/ | ||
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. Simplify a bit layout:
|
||
COPY --from=build /usr/bin/redis-cli /bin/ | ||
|
||
HEALTHCHECK --interval=10s --timeout=1s --start-period=30s --retries=3 \ | ||
CMD ./bin/redis-cli -p 6666 PING | grep -E '(PONG|NOAUTH)' || exit 1 | ||
|
||
COPY ./LICENSE ./NOTICE ./DISCLAIMER ./ | ||
COPY ./licenses ./licenses | ||
COPY ./LICENSE ./NOTICE ./DISCLAIMER ./licenses /kvrocks/ | ||
COPY ./kvrocks.conf /var/lib/kvrocks/ | ||
|
||
EXPOSE 6666:6666 | ||
|
||
ENTRYPOINT ["./bin/kvrocks", "-c", "/var/lib/kvrocks/kvrocks.conf", "--dir", "/var/lib/kvrocks", "--pidfile", "/var/run/kvrocks/kvrocks.pid"] | ||
ENTRYPOINT ["kvrocks", "-c", "/var/lib/kvrocks/kvrocks.conf", "--dir", "/var/lib/kvrocks", "--pidfile", "/var/run/kvrocks/kvrocks.pid"] |
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.
Add
.gitignore
content. Avoid build content conflict issues.