Files
osirose-new/auth-service/Dockerfile
raven 754522b080 - update: Dockerfile layer reordering to speed up build times and lower image space needed
- add: .dockerignore file to reduce file transfers and remove unneeded files in image
2024-12-21 13:10:37 -05:00

44 lines
1018 B
Docker

FROM rust:1.83-slim-bookworm AS builder
LABEL authors="raven"
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends --assume-yes \
pkg-config \
libssl-dev \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/utils
COPY ./utils .
WORKDIR /usr/src/proto
COPY ./proto .
# Set the working directory
WORKDIR /usr/src/auth-service
# Copy the project files
COPY ./auth-service .
# Build the application in release mode
RUN cargo build --release
# Use a minimal base image to run the application
FROM debian:bookworm-slim
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends --assume-yes \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy the compiled binary
COPY --from=builder /usr/src/auth-service/target/release/auth-service /usr/local/bin/auth-service
# Expose the service port
EXPOSE 50051
# Set the entrypoint for the container
CMD ["auth-service"]