Skip to content

Commit 42f91f9

Browse files
Improve cache for release containers
commit-id:2d0b9f21
1 parent cffcb4b commit 42f91f9

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

.dockerignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
!Cargo.toml
55
!run-josh.sh
66
!src
7-
!josh-ui
7+
!josh-ui/public
8+
!josh-ui/src
9+
!josh-ui/*.toml
10+
!josh-ui/*.rs
11+
!josh-ui/*.json
812
!josh-proxy
913
!josh-rpc
1014
!josh-ssh-shell

Dockerfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ RUN pip3 install \
9191

9292
RUN apk add --no-cache go nodejs npm openssh-client patch
9393

94+
WORKDIR /usr/src/josh
95+
9496
FROM dev as dev-local
9597

9698
RUN mkdir -p /opt/cache && \
@@ -121,21 +123,26 @@ RUN adduser \
121123
-g '' \
122124
dev
123125

124-
FROM dev as dev-ci
126+
FROM dev as dev-cache
125127

126128
COPY --from=dev-planner /usr/src/josh/recipe.json .
127129
ENV CARGO_TARGET_DIR=/opt/cargo-target
130+
131+
FROM dev-cache as dev-ci
132+
128133
RUN cargo chef cook --workspace --recipe-path recipe.json
129134

130135
RUN mkdir -p josh-ui
131136
COPY josh-ui/package.json josh-ui/package-lock.json josh-ui/
132137
RUN cd josh-ui && npm install
133138

134-
FROM dev as build
139+
FROM dev-cache as build
135140

136-
WORKDIR /usr/src/josh
137-
COPY . .
141+
RUN cargo chef cook --release --workspace --recipe-path recipe.json
142+
143+
COPY Cargo.toml Cargo.lock josh-ui josh-ui/
138144
RUN cargo build -p josh-ui --release
145+
COPY . .
139146
RUN --mount=target=.git,from=git \
140147
cargo build -p josh-proxy -p josh-ssh-shell --release
141148

@@ -159,8 +166,8 @@ RUN apk add --no-cache \
159166
COPY --from=dev --link=false /opt/git-install /opt/git-install
160167
ENV PATH=${PATH}:/opt/git-install/bin
161168

162-
COPY --from=build --link=false /usr/src/josh/target/release/josh-proxy /usr/bin/
163-
COPY --from=build --link=false /usr/src/josh/target/release/josh-ssh-shell /usr/bin/
169+
COPY --from=build --link=false /opt/cargo-target/release/josh-proxy /usr/bin/
170+
COPY --from=build --link=false /opt/cargo-target/release/josh-ssh-shell /usr/bin/
164171
COPY --from=build --link=false /usr/src/josh/static/ /josh/static/
165172

166173
ARG S6_OVERLAY_VERSION=3.1.2.1

josh-ui/.dockerignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)