File tree Expand file tree Collapse file tree 4 files changed +55
-14
lines changed Expand file tree Collapse file tree 4 files changed +55
-14
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ axum = "0.7.5"
8
8
axum-extra = { version = " 0.9.3" , features = [" form" ] }
9
9
base64 = " 0.22.1"
10
10
chrono = " 0.4.38"
11
+ ctrlc = { version = " 3.4.5" , features = [" termination" ] }
11
12
html-escape = " 0.2.13"
12
13
regex = " 1.10.6"
13
14
rustc_version_runtime = " 0.3.0"
Original file line number Diff line number Diff line change 1
- FROM rust:1-bookworm as builder
1
+ FROM rust:latest AS builder
2
2
3
- RUN apt-get update && apt-get install -y \
4
- ca-certificates \
5
- dumb-init
3
+ RUN rustup target add x86_64-unknown-linux-musl
4
+ RUN apt update && apt install -y musl-tools musl-dev
6
5
7
6
WORKDIR /app
8
7
COPY . .
9
- RUN cargo build --bins --release
8
+ RUN cargo build --target x86_64-unknown-linux-musl --release
10
9
11
- FROM debian:bookworm-slim
12
- LABEL org.opencontainers.image.source https://github.com/regexplanet/regexplanet-rust
10
+ RUN find .
11
+
12
+ FROM scratch
13
13
14
14
ARG COMMIT="(not set)"
15
15
ARG LASTMOD="(not set)"
16
16
ENV COMMIT=$COMMIT
17
17
ENV LASTMOD=$LASTMOD
18
18
19
19
WORKDIR /app
20
- COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
21
- COPY --from=builder /usr/bin/dumb-init /usr/bin/dumb-init
22
- COPY --from=builder /app/target/release/regexplanet-rust /app/regexplanet-rust
20
+ COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/regexplanet-rust /app/regexplanet-rust
23
21
COPY ./static /app/static
24
- ENTRYPOINT ["/usr/bin/dumb-init" , "--" ]
25
22
CMD ["/app/regexplanet-rust" ]
Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ use html_escape::encode_text;
11
11
12
12
#[ tokio:: main]
13
13
async fn main ( ) {
14
+
15
+ ctrlc:: set_handler ( move || {
16
+ std:: process:: exit ( 0 ) ;
17
+ } ) . expect ( "Error setting Ctrl-C handler" ) ;
18
+
14
19
// build our application with a single route
15
20
let app = Router :: new ( )
16
21
//.route_service("/", get(|| async { axum::Redirect::temporary("https://www.regexplanet.com/advanced/rust/index.html") }))
You can’t perform that action at this time.
0 commit comments