48 lines
715 B
Text
48 lines
715 B
Text
|
# Build image
|
||
|
FROM docker.io/rust:alpine AS build
|
||
|
|
||
|
RUN apk add --no-cache musl-dev
|
||
|
|
||
|
WORKDIR /usr/src
|
||
|
|
||
|
# Create blank project
|
||
|
RUN cargo new homepage
|
||
|
|
||
|
WORKDIR /usr/src/homepage
|
||
|
|
||
|
COPY Cargo.* .
|
||
|
|
||
|
# Dummy build to cache dependencies
|
||
|
RUN cargo build --release
|
||
|
|
||
|
COPY src ./src
|
||
|
|
||
|
COPY templates ./templates
|
||
|
|
||
|
# Build the actual app
|
||
|
RUN touch src/main.rs && \
|
||
|
cargo build --release
|
||
|
|
||
|
|
||
|
|
||
|
# Runtime image
|
||
|
FROM docker.io/alpine
|
||
|
|
||
|
WORKDIR /homepage
|
||
|
|
||
|
ARG GID=8686
|
||
|
ARG UID=8686
|
||
|
|
||
|
RUN addgroup -g ${GID} homepage && \
|
||
|
adduser -u ${UID} -D -H -G homepage homepage
|
||
|
|
||
|
USER homepage:homepage
|
||
|
|
||
|
EXPOSE 8080
|
||
|
|
||
|
COPY --from=build /usr/src/homepage/target/release/homepage /usr/local/bin/homepage
|
||
|
|
||
|
COPY assets ./assets
|
||
|
|
||
|
ENTRYPOINT ["homepage"]
|