-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (44 loc) · 1.25 KB
/
Dockerfile
File metadata and controls
67 lines (44 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# UI build stage
FROM node:24-alpine AS ui-builder
WORKDIR /app/ui
# Copy package files
COPY ui/package.json ui/package-lock.json ./
# Install dependencies
RUN npm ci
# Copy UI source
COPY ui/ ./
# Build UI
RUN npm run build
# Rust build stage
FROM rust:1.93.1-alpine AS builder
RUN apk add --no-cache musl-dev perl make
WORKDIR /app
# Copy manifests
COPY Cargo.toml Cargo.lock ./
# Create dummy main.rs to cache dependencies
RUN mkdir src && \
echo "fn main() {}" > src/main.rs && \
echo "pub fn dummy() {}" > src/lib.rs
# Build dependencies (this layer will be cached)
RUN cargo build --release && \
rm -rf src
# Copy actual source code
COPY src ./src
# Build the actual binary
RUN touch src/main.rs src/lib.rs && \
cargo build --release
# Runtime stage
FROM alpine:3.20
RUN apk add --no-cache ca-certificates
WORKDIR /app
# Copy UI dist from ui-builder
COPY --from=ui-builder /app/ui/dist /app/ui/dist
# Copy the binary from builder
COPY --from=builder /app/target/release/cognito-emulator /app/cognito-emulator
# Default port
ENV PORT=9229
EXPOSE 9229
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \
CMD wget --quiet --spider http://127.0.0.1:${PORT}/health || exit 1
USER nobody
CMD ["/app/cognito-emulator"]