-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example of Earthly, needs fixes for node build paths
Signed-off-by: AlexMikhalev <[email protected]>
- Loading branch information
1 parent
3675c12
commit 7915ba6
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
VERSION 0.7 | ||
PROJECT applied-knowledge-systems/atomic-server | ||
# You can compile front end separately and copy dist folder | ||
# IMPORT ./browser AS browser | ||
FROM rust:latest | ||
WORKDIR /code | ||
|
||
main-pipeline: | ||
PIPELINE --push | ||
TRIGGER push main | ||
TRIGGER pr main | ||
ARG tag=latest | ||
BUILD +build --tag=$tag | ||
|
||
deps: | ||
RUN curl -fsSL https://bun.sh/install | bash | ||
RUN /root/.bun/bin/bun install -y pnpm | ||
# COPY . . | ||
COPY --dir server lib cli desktop Cargo.lock Cargo.toml . | ||
# RUN mkdir src | ||
# RUN touch src/main.rs # adding main.rs stub so cargo fetch works to prepare the cache | ||
RUN cargo fetch | ||
|
||
test: | ||
FROM +deps | ||
RUN cargo test | ||
|
||
build: | ||
FROM +deps | ||
RUN rustup target add x86_64-unknown-linux-musl | ||
RUN apt update && apt install -y musl-tools musl-dev | ||
RUN update-ca-certificates | ||
WORKDIR /app | ||
# FIXME: Joep you need to fix this line and modify Earthfile inside browser | ||
# COPY browser+build/dist ./public | ||
COPY --dir server lib cli desktop Cargo.lock Cargo.toml . | ||
RUN cargo build --release --bin atomic-server --config net.git-fetch-with-cli=true --target x86_64-unknown-linux-musl | ||
RUN strip -s /app/target/x86_64-unknown-linux-musl/release/atomic-server | ||
SAVE ARTIFACT /app/target/x86_64-unknown-linux-musl/release/atomic-server | ||
|
||
docker: | ||
# We only need a small runtime for this step, but make sure glibc is installed | ||
FROM scratch | ||
COPY --chmod=0755 +build/atomic-server /atomic-server-bin | ||
# For a complete list of possible ENV vars or available flags, run with `--help` | ||
ENV ATOMIC_STORE_PATH="/atomic-storage/db" | ||
ENV ATOMIC_CONFIG_PATH="/atomic-storage/config.toml" | ||
ENV ATOMIC_PORT="80" | ||
EXPOSE 80 | ||
VOLUME /atomic-storage | ||
ENTRYPOINT ["/atomic-server-bin"] | ||
SAVE IMAGE --push ghcr.io/applied-knowledge-systems/atomic-server:edge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
VERSION 0.7 | ||
PROJECT applied-knowledge-systems/atomic-server | ||
FROM node:latest | ||
WORKDIR browser | ||
|
||
main-pipeline: | ||
PIPELINE --push | ||
TRIGGER push main | ||
TRIGGER pr main | ||
ARG tag=latest | ||
BUILD +build --tag=$tag | ||
|
||
deps: | ||
RUN curl -f https://get.pnpm.io/v6.14.js | node - add --global pnpm | ||
COPY . . | ||
RUN pnpm install --no-frozen-lockfile | ||
SAVE ARTIFACT node_modules /node_modules | ||
|
||
build: | ||
FROM +deps | ||
RUN pnpm run build | ||
SAVE ARTIFACT dist /dist AS LOCAL dist |