-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (41 loc) · 1.15 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Rust builder
FROM rust:1.82-slim-bullseye AS backend-builder
RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev pkg-config
WORKDIR /build
COPY Cargo.* .
COPY src/ ./src/
COPY migrations/ ./migrations/
COPY .sqlx/ ./.sqlx/
ARG LITCRYPT_ENCRYPT_KEY
ARG STRIPE_SECRET
ARG DATABASE_URL
ENV LITCRYPT_ENCRYPT_KEY=$LITCRYPT_ENCRYPT_KEY
ENV STRIPE_SECRET=$STRIPE_SECRET
ENV DATABASE_URL=$DATABASE_URL
RUN SQLX_OFFLINE=true cargo build --release
# front builder
FROM denoland/deno:2.1.1 AS frontend-builder
WORKDIR /build
COPY frontend .
RUN deno install
RUN deno task build
#
# Runtime
#
FROM nginx:1-bullseye
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
RUN apt-get update && apt-get install -y \
libssl-dev \
libc6 \
libgcc-s1 \
libstdc++6 \
ca-certificates
WORKDIR /app
COPY --from=backend-builder /build/target/release/rlarndg /app/backend
COPY --from=frontend-builder /build/dist/ /app/frontend/
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY sources.json /app/sources.json
COPY migrations/ /app/migrations/
RUN chmod 777 ./backend
CMD ["/bin/sh", "-c", "service nginx start && ./backend --source sources.json"]