Skip to content

Commit 81ab9d4

Browse files
committed
try build docker image
1 parent 73808c5 commit 81ab9d4

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/bevy_mod_scripting.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ on:
1313

1414
name: Check and Lint - bevy_mod_scripting
1515

16+
17+
env:
18+
19+
REGISTRY: ghcr.io
20+
IMAGE_NAME: bevy-mod-scripting
21+
1622
concurrency:
1723
# Use github.run_id on main branch
1824
# Use github.event.pull_request.number on pull requests, so it's unique per pull request
@@ -21,6 +27,37 @@ concurrency:
2127
cancel-in-progress: true
2228

2329
jobs:
30+
31+
build-ci-image:
32+
runs-on: ubuntu-latest
33+
# if: github.ref == 'refs/heads/main' || github.ref == 'staging'
34+
permissions:
35+
contents: read
36+
packages: write
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
- name: Log into registry ${{ env.REGISTRY }}
41+
if: github.event_name != 'pull_request'
42+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
43+
with:
44+
registry: ${{ env.REGISTRY }}
45+
username: ${{ github.repository_owner }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Extract Docker metadata
48+
id: meta
49+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
52+
- name: Build and push Docker image
53+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
54+
with:
55+
context: .
56+
push: true
57+
file: ./crates/xtask/Dockerfile
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}
60+
2461
generate-job-matrix:
2562
runs-on: ubuntu-latest
2663
outputs:

crates/xtask/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM rust:latest AS base
2+
RUN cargo install sccache --version ^0.7
3+
RUN cargo install cargo-chef --version ^0.1
4+
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
5+
6+
FROM base AS planner
7+
WORKDIR /app
8+
COPY . .
9+
RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
10+
cargo chef prepare --recipe-path recipe.json
11+
12+
FROM base as builder
13+
WORKDIR /app
14+
COPY --from=planner /app/recipe.json recipe.json
15+
RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
16+
cargo chef cook --release --recipe-path recipe.json
17+
COPY . .
18+
RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
19+
cargo xtask init

0 commit comments

Comments
 (0)