Skip to content

Commit 438d05a

Browse files
committed
Improved docker rust cache #735
Run with cache command instead of args Revert Fix maybe Remove output Try other with docker back again try GET_RUST_CACHE_MOUNTS Improve caching Use latest version of earthly rust image
1 parent fab8193 commit 438d05a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Earthfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
VERSION --try --global-cache 0.7
22
PROJECT ontola/atomic-server
33
IMPORT ./browser AS browser
4-
IMPORT github.com/earthly/lib/rust:2.2.11 AS rust
4+
IMPORT github.com/earthly/lib/rust AS rust
55
FROM rust:1.73.0-buster
66
WORKDIR /code
77

@@ -41,20 +41,20 @@ source:
4141
COPY --keep-ts Cargo.toml Cargo.lock ./
4242
COPY --keep-ts --dir server lib cli ./
4343
COPY browser+build/dist /code/browser/data-browser/dist
44+
DO rust+CARGO --args=fetch
4445

4546
cross-build:
4647
FROM +source
4748
ARG --required TARGET
48-
# This does not yet cache properly
49-
# https://github.com/earthly/lib/issues/34
49+
DO rust+GET_RUST_CACHE_MOUNTS
5050
WITH DOCKER
51-
RUN cross build --target $TARGET --release
51+
RUN --mount=$EARTHLY_RUST_CARGO_HOME_CACHE --mount=$EARTHLY_RUST_TARGET_CACHE cross build --target $TARGET --release
5252
END
5353
SAVE ARTIFACT ./target/$TARGET/release/atomic-server AS LOCAL artifact/bin/atomic-server-$TARGET
5454

5555
build:
5656
FROM +source
57-
DO rust+CARGO --args="build --release" --output="release/[^/\.]+"
57+
DO rust+CARGO --args="build --offline --release" --output="release/[^/\.]+"
5858
RUN ./target/release/atomic-server --version
5959
SAVE ARTIFACT ./target/release/atomic-server AS LOCAL artifact/bin/atomic-server-x86_64-unknown-linux-gnu
6060

docs/src/atomicserver/installation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The `dockerfile` is located in the project root, above this `server` folder.
1818
- See dockerhub for a [list of all the available tags](https://hub.docker.com/repository/docker/joepmeneer/atomic-server/tags?page=1&ordering=last_updated) (e.g. the `develop` tag for the very latest version)
1919
- If you want to make changes (e.g. to the port), make sure to pass the relevant CLI options (e.g. `--port 9883`).
2020
- If you want to update, run `docker pull joepmeneer/atomic-server` and docker should fetch the latest version.
21+
- By default, docker downloads the `latest` tag. You can find other tags [here](https://hub.docker.com/repository/docker/joepmeneer/atomic-server/tags).
2122

2223
## 2. Run pre-compiled binary
2324

0 commit comments

Comments
 (0)