This repository was archived by the owner on Mar 19, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (33 loc) · 1.32 KB
/
Dockerfile
File metadata and controls
49 lines (33 loc) · 1.32 KB
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
FROM docker.pkg.github.com/howtocards/backend/builder:1.43 as build
ENV USER="root"
WORKDIR /app
COPY ./Cargo.lock ./Cargo.toml ./
RUN cargo new public-api --bin --name howtocards-public-api && \
cargo new internal-api --bin --name howtocards-internal-api && \
cargo new db --lib --name howtocards-db
COPY ./internal-api/Cargo.toml ./internal-api/Cargo.toml
COPY ./public-api/Cargo.toml ./public-api/Cargo.toml
COPY ./db/Cargo.toml ./db/Cargo.toml
RUN cargo build --release
RUN find ./target -type f -name *howtocards* | xargs rm -rf
COPY ./diesel.toml ./diesel.toml
COPY ./migrations ./migrations
COPY ./db ./db
COPY ./internal-api ./internal-api
COPY ./public-api ./public-api
ARG CRATE_NAME
# RUN cargo test --release --verbose --package howtocards-$CRATE_NAME
RUN cargo build --release --package howtocards-$CRATE_NAME
# ----------------------------------------------------------------
FROM docker.pkg.github.com/howtocards/backend/start-tools:1
ARG CRATE_NAME
WORKDIR /app
RUN touch .env
COPY --from=build /out/diesel /bin/
COPY --from=build /app/target/release/howtocards-$CRATE_NAME ./server
COPY --from=build /app/migrations ./migrations
COPY --from=build /app/diesel.toml ./
COPY ./docker-entrypoint.sh ./entrypoint.sh
RUN chmod +x entrypoint.sh && chmod +x server
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["/app/server"]