-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (37 loc) · 1.51 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
# ------------------------------------------------------------------------------
# Backend
# ------------------------------------------------------------------------------
FROM rust:latest as backend-env
RUN rustup toolchain install nightly
RUN rustup default nightly
WORKDIR /app/backend
COPY ./backend/Cargo.toml Cargo.toml
RUN mkdir src/
RUN echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs
RUN cargo build --release
RUN rm -f target/release/wordle*
FROM backend-env as backend-build
COPY ./backend/src /app/backend/src
COPY ./backend/dict /app/backend/dict
RUN touch ./src/main.rs && cargo build --release
RUN ls /app/backend/target/release/
# ------------------------------------------------------------------------------
# Frontend
# ------------------------------------------------------------------------------
FROM node:16.14.0-alpine3.14 AS frontend-env
WORKDIR /app/frontend
COPY ./frontend/package-lock.json ./frontend/package.json ./
RUN npm install
FROM frontend-env AS frontend-build
COPY ./frontend/ /app/frontend/
RUN npm run build
# ------------------------------------------------------------------------------
# Final Stage
# ------------------------------------------------------------------------------
FROM debian:buster-slim
WORKDIR /app/
COPY ./backend/dict/ /app/dict/
COPY --from=backend-build /app/backend/target/release/wordle-solve-backend /app/wordle-hint-backend
COPY --from=frontend-build /app/frontend/build /app/static
EXPOSE 8080
CMD ["/app/wordle-hint-backend"]