Skip to content

Commit 41ce5d3

Browse files
committed
feat(Docker): ci nginx
1 parent b0a6172 commit 41ce5d3

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ RUN apk add --no-cache git && npm install -g pnpm && pnpm install
1010
COPY views/ .
1111
RUN pnpm build
1212
FROM ubuntu:22.04
13-
RUN apt-get update && apt-get install -y git
13+
RUN apt-get update && apt-get install -y git nginx
1414
COPY --from=backend-builder /app/target/release/jzfs /explore/
1515
RUN chmod +x /explore/jzfs
1616
COPY --from=frontend-builder /app/views/dist /explore/html
17+
COPY script/nginx.conf /etc/nginx/nginx.conf
1718
EXPOSE 80
18-
ENV PORT=80
19-
CMD ["sh", "-c", "/explore/jzfs"]
19+
COPY script/start.sh /explore/start.sh
20+
RUN chmod +x /explore/start.sh
21+
ENTRYPOINT ["sh", "-c", "/explore.sh"]

api/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ impl ApiService {
7070

7171
)
7272
.configure(shell::http::git_route)
73-
.route("{tail:.*}",get().to(dist::dist))
73+
// .route("{tail:.*}",get().to(dist::dist))
7474
;
7575
}
7676
}
7777
mod auth;
7878
mod repo;
7979
mod error;
80-
mod dist;
80+
// mod dist;

script/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
server {
22
listen 80;
3-
root /usr/share/nginx/html;
3+
root /explore/html;
44
index index.html;
55
location /api/ {
66
proxy_pass http://localhost:8080;

script/start.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
function start_jzfs_git() {
4+
echo "Starting jzfs_git..."
5+
sh -c /explore/jzfs & > /dev/null 2>&1
6+
}
7+
8+
function start_nginx() {
9+
echo "Starting nginx..."
10+
nginx -g "daemon off;"
11+
}
12+
13+
start_jzfs_git();
14+
start_nginx();

0 commit comments

Comments
 (0)