Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Commit 2f98796

Browse files
committed
fix(docker): fix the dockerfile for the front and serve the apk at the good endpoint
1 parent 976a96b commit 2f98796

File tree

5 files changed

+52
-88
lines changed

5 files changed

+52
-88
lines changed

docker-compose.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ services:
1616
build:
1717
context: .
1818
dockerfile: back/Dockerfile
19+
networks:
20+
- backToFront
1921
ports:
2022
- "8080:8080"
2123
working_dir: /app
2224

2325
client_web:
2426
build:
25-
context: .
26-
dockerfile: front/Dockerfile
27+
context: front
28+
dockerfile: ./Dockerfile
2729
depends_on:
2830
server:
2931
condition: service_started
@@ -32,9 +34,9 @@ services:
3234
networks:
3335
- backToFront
3436
ports:
35-
- "8081:8081"
37+
- "8081:80"
3638
volumes:
37-
- ./shared-artifacts:/app/share/www
39+
- shared-artifacts:/shared/:ro
3840

3941
volumes:
4042
shared-artifacts:

flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141

142142
packages = forAllSystems (pkgs: {
143143
back = pkgs.callPackage ./back {};
144-
front = pkgs.callPackage ./front {};
145144
});
146145
};
147146
}

front/Dockerfile

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
1-
# Nix builder
2-
FROM nixos/nix:latest AS builder
1+
FROM node:22-bookworm-slim AS build
32

4-
# Copy our source and setup our working dir.
5-
COPY .. /tmp/build
6-
WORKDIR /tmp/build
3+
ENV DEBIAN_FRONTEND=noninteractive
74

8-
# Build our Nix environment (front-web helper)
9-
RUN nix \
10-
--extra-experimental-features "nix-command flakes" \
11-
--option filter-syscalls false \
12-
build .#front
5+
RUN apt-get update && \
6+
apt-get install -y --no-install-recommends \
7+
curl \
8+
ca-certificates && \
9+
apt-get clean && \
10+
rm -rf /var/lib/apt/lists/*
1311

14-
# Copy the Nix store closure into a directory.
15-
RUN mkdir /tmp/nix-store-closure
16-
RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure
12+
RUN corepack enable && corepack prepare pnpm@latest --activate
1713

18-
# Final image is based on scratch.
19-
FROM scratch
14+
RUN npm install -g serve
2015

21-
# Copy /nix/store and the built result
22-
COPY --from=builder /tmp/nix-store-closure /nix/store
23-
COPY --from=builder /tmp/build/result /app
16+
WORKDIR /app
2417

25-
# Expose client_web port and run
26-
EXPOSE 8081
27-
CMD ["/app/bin/web"]
18+
COPY package.json pnpm-lock.yaml ./
19+
20+
ENV CI=true
21+
RUN pnpm install --frozen-lockfile
22+
23+
COPY . .
24+
25+
RUN pnpm build:web
26+
27+
FROM nginx:alpine
28+
COPY --from=build /app/dist /usr/share/nginx/html
29+
COPY nginx.conf /etc/nginx/conf.d/default.conf
30+
31+
# Expose to 80 and remap it in compose since nginx defaults to 80 without parameters possible
32+
EXPOSE 80
33+
CMD ["nginx", "-g", "daemon off;"]

front/default.nix

Lines changed: 0 additions & 62 deletions
This file was deleted.

front/nginx.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
server {
2+
listen 80;
3+
4+
root /usr/share/nginx/html;
5+
index index.html;
6+
7+
location / {
8+
try_files $uri /index.html =404;
9+
}
10+
11+
location /client.apk {
12+
alias /shared/client.apk;
13+
}
14+
15+
location /shared/ {
16+
alias /shared/;
17+
autoindex on;
18+
}
19+
}

0 commit comments

Comments
 (0)