|
| 1 | +VERSION 0.7 |
| 2 | +PROJECT applied-knowledge-systems/atomic-server |
| 3 | +# You can compile front end separately and copy dist folder |
| 4 | +# IMPORT ./browser AS browser |
| 5 | +FROM rust:latest |
| 6 | +WORKDIR /code |
| 7 | + |
| 8 | +main-pipeline: |
| 9 | + PIPELINE --push |
| 10 | + TRIGGER push main |
| 11 | + TRIGGER pr main |
| 12 | + ARG tag=latest |
| 13 | + BUILD +build --tag=$tag |
| 14 | + |
| 15 | +deps: |
| 16 | + RUN curl -fsSL https://bun.sh/install | bash |
| 17 | + RUN /root/.bun/bin/bun install -y pnpm |
| 18 | + # COPY . . |
| 19 | + COPY --dir server lib cli desktop Cargo.lock Cargo.toml . |
| 20 | + # RUN mkdir src |
| 21 | + # RUN touch src/main.rs # adding main.rs stub so cargo fetch works to prepare the cache |
| 22 | + RUN cargo fetch |
| 23 | + |
| 24 | +test: |
| 25 | + FROM +deps |
| 26 | + RUN cargo test |
| 27 | + |
| 28 | +build: |
| 29 | + FROM +deps |
| 30 | + RUN rustup target add x86_64-unknown-linux-musl |
| 31 | + RUN apt update && apt install -y musl-tools musl-dev |
| 32 | + RUN update-ca-certificates |
| 33 | + WORKDIR /app |
| 34 | + # FIXME: Joep you need to fix this line and modify Earthfile inside browser |
| 35 | + # COPY browser+build/dist ./public |
| 36 | + COPY --dir server lib cli desktop Cargo.lock Cargo.toml . |
| 37 | + RUN cargo build --release --bin atomic-server --config net.git-fetch-with-cli=true --target x86_64-unknown-linux-musl |
| 38 | + RUN strip -s /app/target/x86_64-unknown-linux-musl/release/atomic-server |
| 39 | + SAVE ARTIFACT /app/target/x86_64-unknown-linux-musl/release/atomic-server |
| 40 | + |
| 41 | +docker: |
| 42 | + # We only need a small runtime for this step, but make sure glibc is installed |
| 43 | + FROM scratch |
| 44 | + COPY --chmod=0755 +build/atomic-server /atomic-server-bin |
| 45 | + # For a complete list of possible ENV vars or available flags, run with `--help` |
| 46 | + ENV ATOMIC_STORE_PATH="/atomic-storage/db" |
| 47 | + ENV ATOMIC_CONFIG_PATH="/atomic-storage/config.toml" |
| 48 | + ENV ATOMIC_PORT="80" |
| 49 | + EXPOSE 80 |
| 50 | + VOLUME /atomic-storage |
| 51 | + ENTRYPOINT ["/atomic-server-bin"] |
| 52 | + SAVE IMAGE --push ghcr.io/applied-knowledge-systems/atomic-server:edge |
0 commit comments