Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ========================
# Build Stage
# ========================
FROM rust:1.89.0-alpine3.20 AS builder

# Install build dependencies, including static OpenSSL libraries
RUN apk add --no-cache \
pkgconfig \
build-base \
curl

# Set the working directory
WORKDIR /usr/src/app

# Copy over Cargo.toml and Cargo.lock for dependency caching
COPY Cargo.toml Cargo.lock ./

# Copy over all the source code
COPY . .

# Build the project in release mode for the MUSL target
RUN cargo build --release --bin homegate

# ========================
# Runtime Stage
# ========================
FROM alpine:3.20

# Install runtime dependencies (only ca-certificates)
RUN apk add --no-cache ca-certificates

# Copy the compiled binary from the builder stage
COPY --from=builder /usr/src/app/target/release/homegate /usr/local/bin/homegate

# Set the working directory
WORKDIR /usr/local/bin

# Expose the port the homegate listens on (should match that of config.toml)
EXPOSE 8080

# Set the default command to run the binary
CMD ["homegate"]
Loading