Skip to content

Commit

Permalink
Improved docker rust cache #735
Browse files Browse the repository at this point in the history
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
  • Loading branch information
joepio committed Jan 11, 2024
1 parent fab8193 commit 438d05a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VERSION --try --global-cache 0.7
PROJECT ontola/atomic-server
IMPORT ./browser AS browser
IMPORT github.com/earthly/lib/rust:2.2.11 AS rust
IMPORT github.com/earthly/lib/rust AS rust
FROM rust:1.73.0-buster
WORKDIR /code

Expand Down Expand Up @@ -41,20 +41,20 @@ source:
COPY --keep-ts Cargo.toml Cargo.lock ./
COPY --keep-ts --dir server lib cli ./
COPY browser+build/dist /code/browser/data-browser/dist
DO rust+CARGO --args=fetch

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

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

Expand Down
1 change: 1 addition & 0 deletions docs/src/atomicserver/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The `dockerfile` is located in the project root, above this `server` folder.
- 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)
- If you want to make changes (e.g. to the port), make sure to pass the relevant CLI options (e.g. `--port 9883`).
- If you want to update, run `docker pull joepmeneer/atomic-server` and docker should fetch the latest version.
- By default, docker downloads the `latest` tag. You can find other tags [here](https://hub.docker.com/repository/docker/joepmeneer/atomic-server/tags).

## 2. Run pre-compiled binary

Expand Down

0 comments on commit 438d05a

Please sign in to comment.