-
-
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 #341 from systemaccounting/340-requests-by-account…
…-rust 340 rewrite go requests-by-account service in rust
- Loading branch information
Showing
10 changed files
with
186 additions
and
183 deletions.
There are no files selected for viewing
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
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/requests-by-account | ||
COPY . ./ | ||
|
||
RUN go build -o requests-by-account ./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=requests-by-account | ||
ENV UID=10006 | ||
|
||
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/requests-by-account/Cargo.toml \ | ||
--target x86_64-unknown-linux-musl \ | ||
--release | ||
|
||
COPY --from=builder /app/services/requests-by-account/requests-by-account . | ||
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/requests-by-account /usr/local/bin | ||
|
||
EXPOSE 10006 | ||
|
||
CMD ["/app/requests-by-account"] | ||
USER requests-by-account:requests-by-account | ||
|
||
CMD [ "/usr/local/bin/requests-by-account" ] |
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 = "requests-by-account" | ||
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"] } |
This file was deleted.
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
Oops, something went wrong.