Skip to content

Commit

Permalink
switch request-create docker image to rust
Browse files Browse the repository at this point in the history
  • Loading branch information
mxfactorial committed Mar 19, 2024
1 parent 1b4c57d commit ad90567
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions docker/dev/request-create.Dockerfile
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" ]

0 comments on commit ad90567

Please sign in to comment.