Skip to content

Commit b34829e

Browse files
committed
feat(containers): add containers
ci: build example containers on push
1 parent 18914d2 commit b34829e

124 files changed

Lines changed: 21860 additions & 6 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/containers.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Publish Container Images
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "containers/**"
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_PREFIX: ${{ github.repository_owner }}/lab
13+
14+
jobs:
15+
list-containers:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
matrix: ${{ steps.list.outputs.matrix }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- id: list
23+
run: |
24+
containers=$(ls -d containers/*/ \
25+
| xargs -n1 basename \
26+
| jq -R -s -c 'split("\n") | map(select(length > 0))')
27+
echo "matrix=${containers}" >> "$GITHUB_OUTPUT"
28+
29+
build:
30+
needs: list-containers
31+
if: needs.list-containers.outputs.matrix != '[]'
32+
strategy:
33+
matrix:
34+
container: ${{ fromJson(needs.list-containers.outputs.matrix) }}
35+
arch: [amd64, arm64]
36+
include:
37+
- arch: amd64
38+
runner: ubuntu-24.04
39+
- arch: arm64
40+
runner: ubuntu-24.04-arm
41+
runs-on: ${{ matrix.runner }}
42+
permissions:
43+
contents: read
44+
packages: write
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- uses: docker/setup-buildx-action@v3
49+
50+
- uses: docker/login-action@v3
51+
with:
52+
registry: ${{ env.REGISTRY }}
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- uses: docker/build-push-action@v6
57+
with:
58+
context: containers/${{ matrix.container }}
59+
push: true
60+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.container }}:main-${{ matrix.arch }}
61+
cache-from: type=gha,scope=${{ matrix.container }}-${{ matrix.arch }}
62+
cache-to: type=gha,mode=max,scope=${{ matrix.container }}-${{ matrix.arch }}
63+
64+
merge-manifest:
65+
needs: [list-containers, build]
66+
if: needs.list-containers.outputs.matrix != '[]'
67+
strategy:
68+
matrix:
69+
container: ${{ fromJson(needs.list-containers.outputs.matrix) }}
70+
runs-on: ubuntu-latest
71+
permissions:
72+
contents: read
73+
packages: write
74+
steps:
75+
- uses: docker/setup-buildx-action@v3
76+
77+
- uses: docker/login-action@v3
78+
with:
79+
registry: ${{ env.REGISTRY }}
80+
username: ${{ github.actor }}
81+
password: ${{ secrets.GITHUB_TOKEN }}
82+
83+
- name: Create multi-arch manifest
84+
run: |
85+
docker buildx imagetools create \
86+
-t ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.container }}:main \
87+
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.container }}:main-amd64 \
88+
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.container }}:main-arm64

containers/create-astro/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# build output
2+
dist/
3+
4+
# generated types
5+
.astro/
6+
7+
# dependencies
8+
node_modules/
9+
10+
# logs
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store
22+
23+
# jetbrains setting folder
24+
.idea/

containers/create-astro/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:22-alpine
2+
3+
WORKDIR /app
4+
5+
COPY package.json package-lock.json ./
6+
RUN npm ci
7+
8+
COPY . .
9+
10+
EXPOSE 4321
11+
12+
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]

containers/create-astro/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Astro Starter Kit: Basics
2+
3+
```sh
4+
npm create astro@latest -- --template basics
5+
```
6+
7+
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
8+
9+
## 🚀 Project Structure
10+
11+
Inside of your Astro project, you'll see the following folders and files:
12+
13+
```text
14+
/
15+
├── public/
16+
│ └── favicon.svg
17+
├── src
18+
│   ├── assets
19+
│   │   └── astro.svg
20+
│   ├── components
21+
│   │   └── Welcome.astro
22+
│   ├── layouts
23+
│   │   └── Layout.astro
24+
│   └── pages
25+
│   └── index.astro
26+
└── package.json
27+
```
28+
29+
To learn more about the folder structure of an Astro project, refer to [our guide on project structure](https://docs.astro.build/en/basics/project-structure/).
30+
31+
## 🧞 Commands
32+
33+
All commands are run from the root of the project, from a terminal:
34+
35+
| Command | Action |
36+
| :------------------------ | :----------------------------------------------- |
37+
| `npm install` | Installs dependencies |
38+
| `npm run dev` | Starts local dev server at `localhost:4321` |
39+
| `npm run build` | Build your production site to `./dist/` |
40+
| `npm run preview` | Preview your build locally, before deploying |
41+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
42+
| `npm run astro -- --help` | Get help using the Astro CLI |
43+
44+
## 👀 Want to learn more?
45+
46+
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// @ts-check
2+
import { defineConfig } from 'astro/config';
3+
4+
// https://astro.build/config
5+
export default defineConfig({});

0 commit comments

Comments
 (0)