-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (35 loc) · 1.13 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
# Frontend Build Stage
FROM node:20.5.1 as frontend-build
WORKDIR /usr/src/app
# Copy only package.json and yarn.lock first to leverage Docker cache
COPY ./frontend ./
# Install dependencies
RUN corepack enable && yarn set version stable && yarn
# Build frontend
RUN yarn build
# Backend Build Stage
FROM rust:buster as backend-build
RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install libpq-dev
WORKDIR /app
COPY . /app/
# Build backend
RUN cargo build --release --features=peregrine --bin=attester_peregrine
RUN cargo build --release --features=spiritnet --bin=attester_spiritnet
# Final Stage
FROM rust:slim-buster
ARG PORT=5656
WORKDIR /app
# Copy frontend build
COPY --from=frontend-build /usr/src/app/dist /usr/share/html
# Copy backend build
COPY --from=backend-build /app/target/release/attester_spiritnet /app/attester_spiritnet
COPY --from=backend-build /app/target/release/attester_peregrine /app/attester_peregrine
# Copy migrations config and scripts
COPY ./migrations /app/migrations
COPY ./scripts/start.sh /app/start.sh
VOLUME /app/config.yaml
EXPOSE ${PORT}
#start the application
CMD ["./start.sh" ]