Skip to content

Commit

Permalink
fix: use debian instead of alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
jetsung committed Dec 11, 2024
1 parent 6e2ae90 commit baefe61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
20 changes: 7 additions & 13 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
FROM rust:alpine AS builder

RUN apk update
RUN apk add --no-cache \
openssl \
openssl-dev \
pkgconfig \
build-base

ENV OPENSSL_DIR=/usr
FROM rust:bookworm AS builder

WORKDIR /app
COPY . .

RUN cargo install --path .

FROM alpine:latest
FROM debian:bookworm-slim
LABEL maintainer="Jetsung Chan<[email protected]>"

RUN apk update && apk add --no-cache openssl libssl3 && rm -rf /var/cache/apk/*
# RUN apt-get update && apt-get install -y locales libssl3 libssl-dev && rm -rf /var/lib/apt/lists/* \
# && localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8
# ENV LANG zh_CN.utf8
RUN apt update && apt install -y openssl libssl-dev && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY --from=builder /usr/local/cargo/bin/filetas /usr/local/bin/filetas
COPY --from=builder /app/static /app/static
COPY --from=builder /app/templates /app/templates


EXPOSE 8000
CMD [ "filetas" ]
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async fn proxy(Path(uri): Path<String>) -> impl IntoResponse {
}

// favicon.ico 路由
async fn favicon() -> impl IntoResponse {
async fn favicon_ico() -> impl IntoResponse {
match tokio::fs::read("static/favicon.ico").await {
Ok(content) => (
axum::http::StatusCode::OK,
Expand Down Expand Up @@ -129,7 +129,7 @@ async fn main() {

// 创建路由
let app = Router::new()
.route("/favicon.ico", get(favicon))
.route("/favicon.ico", get(favicon_ico))
.route("/robots.txt", get(robots_txt))
.route("/*uri", get(proxy))
.route("/", get(index_handler));
Expand Down

0 comments on commit baefe61

Please sign in to comment.