-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add alpine based docker images (#39)
- Loading branch information
Showing
5 changed files
with
104 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM rust:alpine AS builder | ||
WORKDIR app | ||
|
||
RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static sqlite-dev sqlite-static | ||
|
||
# First build dependencies, this should cache a dependency layer which | ||
# only needs to be refreshed when Cargo.(lock|toml) is updated | ||
COPY Cargo.lock Cargo.toml ./ | ||
RUN mkdir src && echo "fn main() { panic!(\"why am i running?\") }" > src/main.rs | ||
RUN cargo build --release --locked | ||
RUN rm ./src/main.rs && rmdir ./src | ||
|
||
COPY . . | ||
RUN cargo build --release --locked --bin mollysocket | ||
|
||
|
||
FROM alpine:3 AS runtime | ||
WORKDIR app | ||
|
||
ENV MOLLY_HOST=127.0.0.1 | ||
ENV MOLLY_PORT=8020 | ||
|
||
RUN apk add --no-cache ca-certificates | ||
|
||
COPY --from=builder /app/target/release/mollysocket /usr/local/bin/ | ||
HEALTHCHECK --interval=1m --timeout=3s \ | ||
CMD wget -q --tries=1 "http://$MOLLY_HOST:$MOLLY_PORT/" -O - | grep '"mollysocket":{"version":' | ||
ENTRYPOINT ["/usr/local/bin/mollysocket"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM docker.io/rust:bookworm AS builder | ||
WORKDIR app | ||
|
||
# First build dependencies, this should cache a dependency layer which | ||
# only needs to be refreshed when Cargo.(lock|toml) is updated | ||
COPY Cargo.lock Cargo.toml ./ | ||
RUN mkdir src && echo "fn main() { panic!(\"why am i running?\") }" > src/main.rs | ||
RUN cargo build --release --locked | ||
RUN rm ./src/main.rs && rmdir ./src | ||
|
||
COPY . . | ||
RUN cargo build --release --locked --bin mollysocket | ||
|
||
|
||
FROM docker.io/debian:bookworm-slim AS runtime | ||
WORKDIR app | ||
|
||
ENV MOLLY_HOST=127.0.0.1 | ||
ENV MOLLY_PORT=8020 | ||
|
||
RUN apt update && \ | ||
apt install -y wget libssl3 libsqlite3-0 ca-certificates && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /app/target/release/mollysocket /usr/local/bin/ | ||
HEALTHCHECK --interval=1m --timeout=3s \ | ||
CMD wget -q --tries=1 "http://$MOLLY_HOST:$MOLLY_PORT/" -O - | grep '"mollysocket":{"version":' | ||
ENTRYPOINT ["/usr/local/bin/mollysocket"] |