-
-
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.
switch request-create docker image to rust
- Loading branch information
1 parent
1b4c57d
commit ad90567
Showing
1 changed file
with
30 additions
and
8 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
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-create | ||
COPY . ./ | ||
|
||
RUN go build -o request-create ./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-create | ||
ENV UID=10002 | ||
|
||
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-create/Cargo.toml \ | ||
--target x86_64-unknown-linux-musl \ | ||
--release | ||
|
||
COPY --from=builder /app/services/request-create/request-create . | ||
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-create /usr/local/bin | ||
|
||
EXPOSE 10002 | ||
|
||
CMD ["/app/request-create"] | ||
USER request-create:request-create | ||
|
||
CMD [ "/usr/local/bin/request-create" ] |