Skip to content

Commit 82ed949

Browse files
authored
Merge pull request #1 from Baker-link-Lab/copilot/enhance-template-usability
feat: pre-build Docker image and push to Docker Hub for faster setup
2 parents 71e3b1a + 6cf2323 commit 82ed949

8 files changed

Lines changed: 77 additions & 5 deletions

File tree

.docker/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ FROM rust:1.86.0-bullseye
33
RUN rustup target install thumbv6m-none-eabi
44
RUN cargo install flip-link --version 0.1.10
55
RUN rustup component add rustfmt
6+
RUN rustup component add llvm-tools
7+
RUN cargo install cargo-binutils

.docker/compose.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
services:
22
{{project-name}}:
3-
build:
4-
context: .
5-
dockerfile: Dockerfile
6-
image: "baker-link-env"
3+
image: "bakerlinklab/bakerlink-env:latest"
74
container_name: "{{project-name}}-container"
85
volumes:
96
- "../:/{{project-name}}"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- '.docker/Dockerfile'
8+
workflow_dispatch:
9+
10+
env:
11+
DOCKER_IMAGE: bakerlinklab/bakerlink-env
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Login to Docker Hub
26+
# Requires repository secrets: DOCKERHUB_USERNAME and DOCKERHUB_TOKEN
27+
uses: docker/login-action@v3
28+
with:
29+
username: ${{ secrets.DOCKERHUB_USERNAME }}
30+
password: ${{ secrets.DOCKERHUB_TOKEN }}
31+
32+
- name: Build and push
33+
uses: docker/build-push-action@v6
34+
with:
35+
context: .docker
36+
file: .docker/Dockerfile
37+
push: true
38+
tags: |
39+
${{ env.DOCKER_IMAGE }}:latest
40+
cache-from: type=gha
41+
cache-to: type=gha,mode=max

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"rust-analyzer.cargo.target": "thumbv6m-none-eabi",
3+
"rust-analyzer.check.allTargets": false,
34
"editor.formatOnSave": true
45
}

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ rp2040-hal = { version = "0.10", features = ["rt", "critical-section-impl"] }
1616
rp2040-boot2 = "0.3"
1717
critical-section = "1.0.0"
1818

19+
[dev-dependencies]
20+
defmt-test = "0.3"
21+
22+
[[test]]
23+
name = "example_test"
24+
harness = false
25+
1926
# cargo build/run
2027
[profile.dev]
2128
codegen-units = 1

cargo-generate.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[template]
2-
ignore = ["README.md", "LICENSE"]
2+
ignore = ["README.md", "LICENSE", ".github/"]

rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "1.86.0"
3+
targets = ["thumbv6m-none-eabi"]
4+
components = ["rustfmt", "llvm-tools"]

tests/example_test.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![no_std]
2+
#![no_main]
3+
4+
use defmt_rtt as _;
5+
use panic_probe as _;
6+
use rp2040_hal as _;
7+
8+
#[link_section = ".boot2"]
9+
#[used]
10+
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
11+
12+
#[defmt_test::tests]
13+
mod tests {
14+
use defmt::assert;
15+
16+
#[test]
17+
fn it_works() {
18+
assert!(true);
19+
}
20+
}

0 commit comments

Comments
 (0)