-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #339 from systemaccounting/338-request-by-id-rust
338 rewrite go request-by-id service in rust
- Loading branch information
Showing
15 changed files
with
225 additions
and
218 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,17 +1,39 @@ | ||
FROM mxfactorial/go-base:v1 as builder | ||
FROM rust:latest as builder | ||
|
||
COPY . . | ||
WORKDIR /app | ||
|
||
WORKDIR /app/services/request-by-id | ||
COPY . ./ | ||
|
||
RUN go build -o request-by-id ./cmd | ||
RUN rustup target add x86_64-unknown-linux-musl | ||
RUN apt update && \ | ||
apt install -y musl-tools perl make | ||
RUN update-ca-certificates | ||
|
||
FROM golang:alpine | ||
ENV USER=request-by-id | ||
ENV UID=10005 | ||
|
||
WORKDIR /app | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
"${USER}" | ||
|
||
RUN USER=root cargo build \ | ||
--manifest-path=services/request-by-id/Cargo.toml \ | ||
--target x86_64-unknown-linux-musl \ | ||
--release | ||
|
||
COPY --from=builder /app/services/request-by-id/request-by-id . | ||
FROM alpine | ||
|
||
COPY --from=builder /etc/passwd /etc/passwd | ||
COPY --from=builder /etc/group /etc/group | ||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/request-by-id /usr/local/bin | ||
|
||
EXPOSE 10005 | ||
|
||
CMD ["/app/request-by-id"] | ||
USER request-by-id:request-by-id | ||
|
||
CMD [ "/usr/local/bin/request-by-id" ] |
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,18 @@ | ||
[package] | ||
name = "request-by-id" | ||
version = "0.1.0" | ||
edition = "2021" | ||
rust-version.workspace = true | ||
|
||
[dependencies] | ||
axum = "0.7.4" | ||
tracing = "0.1.40" | ||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } | ||
tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] } | ||
shutdown = { path = "../../crates/shutdown" } | ||
pg = { path = "../../crates/pg" } | ||
service = { path = "../../crates/service" } | ||
types = { path = "../../crates/types" } | ||
|
||
[target.x86_64-unknown-linux-musl.dependencies] | ||
openssl = { version = "0.10", features = ["vendored"] } |
Oops, something went wrong.