-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add Dockerfile and documentation #95
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9c9dadb
feat(server): add dockerfile
SHAcollision 9bbbc92
feat: add Dockerfile and update README for Docker setup
MiguelMedeiros caf53c3
Merge branch 'feat/dockerfile' into feat/dockerfile-new
SHAcollision 49d4512
Merge pull request #94 from pubky/feat/dockerfile-new
SHAcollision 0700fc3
Update readme docker
SHAcollision b6adcab
Fix example docker-compose
SHAcollision 2d7a2a9
Move Docker documentation
SHAcollision 6060460
Update README.md
Nuhvi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/target | ||
/docs | ||
/.github |
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,56 @@ | ||
# ======================== | ||
# Build Stage | ||
# ======================== | ||
FROM rust:1.82.0-alpine3.20 AS builder | ||
|
||
# Install build dependencies, including static OpenSSL libraries | ||
RUN apk add --no-cache \ | ||
musl-dev \ | ||
openssl-dev \ | ||
openssl-libs-static \ | ||
pkgconfig \ | ||
build-base \ | ||
curl | ||
|
||
# Set environment variables for static linking with OpenSSL | ||
ENV OPENSSL_STATIC=yes | ||
ENV OPENSSL_LIB_DIR=/usr/lib | ||
ENV OPENSSL_INCLUDE_DIR=/usr/include | ||
|
||
# Add the MUSL target for static linking | ||
RUN rustup target add x86_64-unknown-linux-musl | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy over Cargo.toml and Cargo.lock for dependency caching | ||
COPY Cargo.toml Cargo.lock ./ | ||
|
||
# Copy over all the source code | ||
COPY . . | ||
|
||
# Build the project in release mode for the MUSL target | ||
RUN cargo build --release --target x86_64-unknown-linux-musl | ||
|
||
# Strip the binary to reduce size | ||
RUN strip target/x86_64-unknown-linux-musl/release/pkarr-server | ||
|
||
# ======================== | ||
# Runtime Stage | ||
# ======================== | ||
FROM alpine:3.20 | ||
|
||
# Install runtime dependencies (only ca-certificates) | ||
RUN apk add --no-cache ca-certificates | ||
|
||
# Copy the compiled binary from the builder stage | ||
COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/pkarr-server /usr/local/bin/pkarr-server | ||
|
||
# Set the working directory | ||
WORKDIR /usr/local/bin | ||
|
||
# Expose the port the pkarr server listens on (should match that of config.toml) | ||
EXPOSE 6881 | ||
|
||
# Set the default command to run the homeserver binary | ||
CMD ["pkarr-server", "--config=./config.toml"] |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you replace this with a link to the server's readme, and move all this to the. server readme?
The root Readme is meant to be mostly theory, and only links to implementation/examples/deployment details.
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.
Done