Skip to content

Commit a81fe8a

Browse files
committed
Fix dev Docker images
1 parent 5fe3e29 commit a81fe8a

File tree

4 files changed

+43
-40
lines changed

4 files changed

+43
-40
lines changed

.dockerignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
.git
2-
/mithril-test-lab
2+
.sock
3+
.socket
34
/target
4-
/**/data
5+
/**/artifacts
6+
/**/data
7+
/**/node_modules

mithril-aggregator/Dockerfile

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,21 @@ RUN adduser --no-create-home --disabled-password appuser
1818
WORKDIR /app
1919

2020
# Copy local dependencies
21-
COPY mithril-stm/ /mithril-stm/
22-
COPY Cargo.lock /mithril-stm/
23-
COPY mithril-common/ /mithril-common/
24-
COPY Cargo.lock /mithril-common/
21+
COPY . .
2522

2623
# Build the app using a dummy main in order to cache dependencies
27-
COPY mithril-aggregator/Cargo.toml /app
28-
COPY Cargo.lock /app/
29-
RUN mkdir -p /app/src/ && echo "fn main () {}" > /app/src/main.rs
30-
RUN cargo build --release --manifest-path /app/Cargo.toml
24+
RUN mv /app/mithril-aggregator /app/mithril-aggregator.1 && mkdir -p /app/mithril-aggregator/src
25+
COPY mithril-aggregator/Cargo.toml /app/mithril-aggregator/
26+
RUN echo "fn main () {}" > /app/mithril-aggregator/src/main.rs
27+
RUN cargo build --release -p mithril-aggregator --manifest-path /app/mithril-aggregator/Cargo.toml
3128

32-
# Copy the rest of the files into the container
33-
COPY ./mithril-aggregator /app/
29+
# Rollback the rest of the files into the container
30+
RUN rm -rf /app/mithril-aggregator && mv /app/mithril-aggregator.1 /app/mithril-aggregator
31+
COPY ./mithril-aggregator/src/main.rs /app/mithril-aggregator/src/
3432

3533
# Build the binary
36-
RUN cargo build --release
34+
RUN cargo build --release -p mithril-aggregator
35+
RUN /app/target/release/mithril-aggregator --version
3736

3837
###############################
3938
# STEP 2: build a small image
@@ -50,7 +49,7 @@ COPY --from=rustbuilder /etc/passwd /etc/passwd
5049
COPY --from=rustbuilder /app/target/release/mithril-aggregator /app/bin/mithril-aggregator
5150

5251
# Copy the config files
53-
COPY --from=rustbuilder /app/config /app/config
52+
COPY --from=rustbuilder /app/mithril-aggregator/config /app/config
5453

5554
#Workdir
5655
WORKDIR /app/

mithril-client/Dockerfile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,21 @@ RUN adduser --no-create-home --disabled-password appuser
1818
WORKDIR /app
1919

2020
# Copy local dependencies
21-
COPY mithril-stm/ /mithril-stm/
22-
COPY Cargo.lock /mithril-stm/
23-
COPY mithril-common/ /mithril-common/
24-
COPY Cargo.lock /mithril-common/
21+
COPY . .
2522

2623
# Build the app using a dummy main in order to cache dependencies
27-
COPY mithril-client/Cargo.toml /app
28-
COPY Cargo.lock /app/
29-
RUN mkdir -p /app/src/ && echo "fn main () {}" > /app/src/main.rs
30-
RUN cargo build --release --manifest-path /app/Cargo.toml
24+
RUN mv /app/mithril-client /app/mithril-client.1 && mkdir -p /app/mithril-client/src
25+
COPY mithril-client/Cargo.toml /app/mithril-client/
26+
RUN echo "fn main () {}" > /app/mithril-client/src/main.rs
27+
RUN cargo build --release -p mithril-client --manifest-path /app/mithril-client/Cargo.toml
3128

32-
# Copy the rest of the files into the container
33-
COPY ./mithril-client /app/
29+
# Rollback the rest of the files into the container
30+
RUN rm -rf /app/mithril-client && mv /app/mithril-client.1 /app/mithril-client
31+
COPY ./mithril-client/src/main.rs /app/mithril-client/src/
3432

3533
# Build the binary
36-
RUN cargo build --release
34+
RUN cargo build --release -p mithril-client
35+
RUN /app/target/release/mithril-client --version
3736

3837
###############################
3938
# STEP 2: build a small image
@@ -50,13 +49,14 @@ COPY --from=rustbuilder /etc/passwd /etc/passwd
5049
COPY --from=rustbuilder /app/target/release/mithril-client /app/bin/mithril-client
5150

5251
# Copy the config files
53-
COPY --from=rustbuilder /app/config /app/config
52+
COPY --from=rustbuilder /app/mithril-client/config /app/config
5453

5554
#Workdir
5655
WORKDIR /app/
56+
RUN chown -R appuser /app/
5757

5858
# Use an unprivileged user
5959
USER appuser
6060

6161
# Run the executable
62-
ENTRYPOINT ["/app/bin/mithril-client"]
62+
ENTRYPOINT ["/app/bin/mithril-client", "-vvv"]

mithril-signer/Dockerfile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ RUN adduser --no-create-home --disabled-password appuser
1818
WORKDIR /app
1919

2020
# Copy local dependencies
21-
COPY mithril-stm/ /mithril-stm/
22-
COPY Cargo.lock /mithril-stm/
23-
COPY mithril-common/ /mithril-common/
24-
COPY Cargo.lock /mithril-common/
21+
COPY . .
2522

2623
# Build the app using a dummy main in order to cache dependencies
27-
COPY mithril-signer/Cargo.toml /app
28-
COPY Cargo.lock /app/
29-
RUN mkdir -p /app/src/ && echo "fn main () {}" > /app/src/main.rs
30-
RUN cargo build --release --manifest-path /app/Cargo.toml
24+
RUN mv /app/mithril-signer /app/mithril-signer.1 && mkdir -p /app/mithril-signer/src
25+
COPY mithril-signer/Cargo.toml /app/mithril-signer/
26+
RUN echo "fn main () {}" > /app/mithril-signer/src/main.rs
27+
RUN cargo build --release -p mithril-signer --manifest-path /app/mithril-signer/Cargo.toml
28+
29+
# Rollback the rest of the files into the container
30+
RUN rm -rf /app/mithril-signer && mv /app/mithril-signer.1 /app/mithril-signer
31+
COPY ./mithril-signer/src/main.rs /app/mithril-signer/src/
3132

32-
# Copy the rest of the files into the container
33-
COPY ./mithril-signer /app/
3433

3534
# Build the binary
36-
RUN cargo build --release
35+
RUN cargo build --release -p mithril-signer
36+
RUN /app/target/release/mithril-signer --version
3737

3838
###############################
3939
# STEP 2: build a small image
@@ -50,10 +50,11 @@ COPY --from=rustbuilder /etc/passwd /etc/passwd
5050
COPY --from=rustbuilder /app/target/release/mithril-signer /app/bin/mithril-signer
5151

5252
# Copy the config files
53-
COPY --from=rustbuilder /app/config /app/config
53+
COPY --from=rustbuilder /app/mithril-signer/config /app/config
5454

5555
#Workdir
5656
WORKDIR /app/
57+
RUN chown -R appuser /app/
5758

5859
# Install cardano-cli
5960
RUN wget -nv -O cardano-bin.tar.gz https://update-cardano-mainnet.iohk.io/cardano-node-releases/cardano-node-1.35.5-linux.tar.gz
@@ -65,4 +66,4 @@ RUN rm -f cardano-bin.tar.gz
6566
USER appuser
6667

6768
# Run the executable
68-
ENTRYPOINT ["/app/bin/mithril-signer"]
69+
ENTRYPOINT ["/app/bin/mithril-signer", "-vvv"]

0 commit comments

Comments
 (0)