Skip to content

Commit 6c8abeb

Browse files
authored
standard was added, build updated (#3)
1 parent 0b367de commit 6c8abeb

8 files changed

Lines changed: 242 additions & 119 deletions

File tree

Lines changed: 7 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,26 @@
1-
name: Build and Push to AWS ECR Public
2-
1+
name: Build and Push GPU CUDA Image
32
on:
43
push:
54
branches:
65
- master
76
paths:
87
- 'gpu-cuda/**'
9-
- '.github/workflows/build-gpu-cuda.yml'
8+
- '.github/workflows/build.yml'
109
pull_request:
1110
branches:
1211
- master
1312
paths:
1413
- 'gpu-cuda/**'
15-
- '.github/workflows/build-gpu-cuda.yml'
14+
- '.github/workflows/build.yml'
1615
workflow_dispatch:
1716
inputs:
1817
tag:
1918
description: 'Image tag'
2019
required: false
2120
default: 'latest'
2221

23-
env:
24-
AWS_REGION: us-east-1
25-
REPOSITORY_NAME: jupyter-docker
26-
IMAGE_NAME: codio/codio-jupyter
27-
TAG_PREFIX: gpu-cuda
28-
ECR_REGISTRY: public.ecr.aws/o0g3m8o6
29-
3022
jobs:
31-
build-and-push:
32-
runs-on: ubuntu-latest
33-
permissions:
34-
id-token: write
35-
contents: read
36-
37-
steps:
38-
- name: Checkout code
39-
uses: actions/checkout@v6
40-
with:
41-
fetch-depth: 0
42-
43-
- name: Configure AWS Credentials
44-
uses: aws-actions/configure-aws-credentials@main
45-
with:
46-
aws-region: us-east-1
47-
role-to-assume: arn:aws:iam::878986216776:role/Github/GithubECRPublicUploadRole_${{ env.REPOSITORY_NAME }}
48-
role-session-name: GithubAction
49-
50-
- name: Login to Amazon ECR
51-
id: login-ecr
52-
uses: aws-actions/amazon-ecr-login@v2
53-
with:
54-
registry-type: public
55-
56-
57-
- name: Set up Docker Buildx
58-
uses: docker/setup-buildx-action@v3
59-
60-
- name: Create and use a new builder instance
61-
run: |
62-
docker buildx create --name ga-builder --use
63-
64-
- name: Set image tags
65-
id: meta
66-
run: |
67-
ECR_REGISTRY="${{ env.ECR_REGISTRY }}"
68-
SHA_SHORT=${{ env.TAG_PREFIX }}-$(echo ${{ github.sha }} | cut -c1-7)
69-
70-
if [ "${{ github.event_name }}" == "pull_request" ]; then
71-
IMAGE_TAG="${{ env.TAG_PREFIX }}-${{ github.event.pull_request.head.ref }}"
72-
else
73-
IMAGE_TAG="${{ env.TAG_PREFIX }}-${{ github.event.inputs.tag || 'latest' }}"
74-
TIMESTAMP=${{ env.TAG_PREFIX }}-$(date +%Y%m%d)
75-
echo "timestamp=${TIMESTAMP}" >> $GITHUB_OUTPUT
76-
fi
77-
78-
echo "ecr_registry=${ECR_REGISTRY}" >> $GITHUB_OUTPUT
79-
echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
80-
echo "sha_short=${SHA_SHORT}" >> $GITHUB_OUTPUT
81-
82-
TAGS="${ECR_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG},${ECR_REGISTRY}/${IMAGE_NAME}:${SHA_SHORT}"
83-
84-
if [ "${{ github.event_name }}" != "pull_request" ]; then
85-
TAGS="${TAGS},${ECR_REGISTRY}/${IMAGE_NAME}:${TIMESTAMP}"
86-
fi
87-
88-
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
89-
90-
- name: Build and push Docker image
91-
uses: docker/build-push-action@v6
92-
timeout-minutes: 30
93-
with:
94-
context: ./gpu-cuda
95-
push: true
96-
tags: ${{ steps.meta.outputs.tags }}
97-
builder: ga-builder
98-
cache-from: type=registry,ref=${{ steps.meta.outputs.ecr_registry }}/${{ env.IMAGE_NAME }}:cache
99-
cache-to: type=registry,mode=max,image-manifest=true,oci-mediatypes=true,ref=${{ steps.meta.outputs.ecr_registry }}/${{ env.IMAGE_NAME }}:cache
100-
101-
- name: Image summary
102-
run: |
103-
{
104-
echo "### Docker Image Published :rocket:"
105-
echo "event name: ${{ github.event_name }}"
106-
echo ""
107-
echo "**Registry:** ${{ steps.meta.outputs.ecr_registry }}"
108-
echo "**Image:** ${IMAGE_NAME}"
109-
echo ""
110-
echo "**Tags:**"
111-
echo "- \`${{ steps.meta.outputs.image_tag }}\`"
112-
echo "- \`${{ steps.meta.outputs.timestamp || 'Timestamp tag is not available for PR' }}\`"
113-
echo "- \`${{ steps.meta.outputs.sha_short }}\`"
114-
echo ""
115-
echo "**Pull command:**"
116-
echo "\`\`\`bash"
117-
echo "docker pull ${{ steps.meta.outputs.ecr_registry }}/${IMAGE_NAME}:${{ steps.meta.outputs.image_tag }}"
118-
echo "\`\`\`"
119-
} | tee -a $GITHUB_STEP_SUMMARY
23+
call-build:
24+
uses: ./.github/workflows/build.yml
25+
with:
26+
prefix: gpu-cuda
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build and Push Standard Image
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths:
7+
- 'standard/**'
8+
- '.github/workflows/build.yml'
9+
pull_request:
10+
branches:
11+
- master
12+
paths:
13+
- 'standard/**'
14+
- '.github/workflows/build.yml'
15+
workflow_dispatch:
16+
inputs:
17+
tag:
18+
description: 'Image tag'
19+
required: false
20+
default: 'latest'
21+
22+
jobs:
23+
call-build:
24+
uses: ./.github/workflows/build.yml
25+
with:
26+
prefix: standard

.github/workflows/build.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Common Build
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
prefix:
7+
required: true
8+
type: string
9+
10+
env:
11+
AWS_REGION: us-east-1
12+
REPOSITORY_NAME: jupyter-docker
13+
IMAGE_NAME: codio/codio-jupyter
14+
ECR_REGISTRY: public.ecr.aws/o0g3m8o6
15+
16+
jobs:
17+
build-and-push:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
id-token: write
21+
contents: read
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v6
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Configure AWS Credentials
30+
uses: aws-actions/configure-aws-credentials@main
31+
with:
32+
aws-region: us-east-1
33+
role-to-assume: arn:aws:iam::878986216776:role/Github/GithubECRPublicUploadRole_${{ env.REPOSITORY_NAME }}
34+
role-session-name: GithubAction
35+
36+
- name: Login to Amazon ECR
37+
id: login-ecr
38+
uses: aws-actions/amazon-ecr-login@v2
39+
with:
40+
registry-type: public
41+
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
- name: Create and use a new builder instance
47+
run: |
48+
docker buildx create --name ga-builder --use
49+
50+
- name: Set image tags
51+
id: meta
52+
run: |
53+
ECR_REGISTRY="${{ env.ECR_REGISTRY }}"
54+
SHA_SHORT=${{ inputs.prefix }}-$(echo ${{ github.sha }} | cut -c1-7)
55+
56+
if [ "${{ github.event_name }}" == "pull_request" ]; then
57+
IMAGE_TAG="${{ inputs.prefix }}-${{ github.event.pull_request.head.ref }}"
58+
else
59+
IMAGE_TAG="${{ inputs.prefix }}-${{ github.event.inputs.tag || 'latest' }}"
60+
TIMESTAMP=${{ inputs.prefix }}-$(date +%Y%m%d)
61+
echo "timestamp=${TIMESTAMP}" >> $GITHUB_OUTPUT
62+
fi
63+
64+
echo "ecr_registry=${ECR_REGISTRY}" >> $GITHUB_OUTPUT
65+
echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
66+
echo "sha_short=${SHA_SHORT}" >> $GITHUB_OUTPUT
67+
68+
TAGS="${ECR_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG},${ECR_REGISTRY}/${IMAGE_NAME}:${SHA_SHORT}"
69+
70+
if [ "${{ github.event_name }}" != "pull_request" ]; then
71+
TAGS="${TAGS},${ECR_REGISTRY}/${IMAGE_NAME}:${TIMESTAMP}"
72+
fi
73+
74+
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
75+
76+
- name: Build and push Docker image
77+
uses: docker/build-push-action@v6
78+
timeout-minutes: 30
79+
with:
80+
context: ./${{ inputs.prefix }}
81+
push: true
82+
tags: ${{ steps.meta.outputs.tags }}
83+
builder: ga-builder
84+
cache-from: type=registry,ref=${{ steps.meta.outputs.ecr_registry }}/${{ env.IMAGE_NAME }}:cache
85+
cache-to: type=registry,mode=max,image-manifest=true,oci-mediatypes=true,ref=${{ steps.meta.outputs.ecr_registry }}/${{ env.IMAGE_NAME }}:cache
86+
87+
- name: Image summary
88+
run: |
89+
{
90+
echo "### Docker Image Published :rocket:"
91+
echo "event name: ${{ github.event_name }}"
92+
echo ""
93+
echo "**Registry:** ${{ steps.meta.outputs.ecr_registry }}"
94+
echo "**Image:** ${IMAGE_NAME}"
95+
echo ""
96+
echo "**Tags:**"
97+
echo "- \`${{ steps.meta.outputs.image_tag }}\`"
98+
echo "- \`${{ steps.meta.outputs.timestamp || 'Timestamp tag is not available for PR' }}\`"
99+
echo "- \`${{ steps.meta.outputs.sha_short }}\`"
100+
echo ""
101+
echo "**Pull command:**"
102+
echo "\`\`\`bash"
103+
echo "docker pull ${{ steps.meta.outputs.ecr_registry }}/${IMAGE_NAME}:${{ steps.meta.outputs.image_tag }}"
104+
echo "\`\`\`"
105+
} | tee -a $GITHUB_STEP_SUMMARY

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# jupyter-docker
22

3-
Docker images build for jupyter environments usind in sandboxes
3+
Docker images build for jupyter environments using in jupyter sandboxes.
4+
5+
Images are compatible with Jupyter original images

gpu-cuda/README.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,41 @@ Docker image for Jupyter Notebook with PyTorch CUDA support and LLM/Data Science
1414

1515
## GitHub Actions Setup
1616

17-
### AWS IAM Role Configuration
18-
The workflow uses OIDC to authenticate with AWS. Ensure you have:
19-
1. An IAM role named `GithubECRUploadRole_jupyter-docker` in account `878986216776`
20-
2. Trust relationship configured for GitHub OIDC provider
21-
3. Permissions to push to ECR Public
22-
23-
### GitHub Secrets
24-
Add this secret to your repository (Settings → Secrets and variables → Actions):
25-
- `ECR_REGISTRY` - Your ECR public registry URL (e.g., `public.ecr.aws/your-alias`)
26-
2717
### Workflow Triggers
28-
- Push to `master` or `main` branch with changes in `gpu/` directory
29-
- Pull requests (builds but doesn't push)
30-
- Manual trigger via workflow_dispatch
18+
- Push to `master` branch with changes in `gpu-cuda/` directory
19+
- Pull requests (excludes timestamped tags)
3120

3221
## Running the Image
3322

3423
### Local with GPU
3524
```bash
3625
docker run --gpus all -p 8888:8888 \
3726
-v $(pwd)/notebooks:/home/jovyan/work \
38-
public.ecr.aws/your-alias/jupyter-gpu:latest
27+
public.ecr.aws/o0g3m8o6/codio-jupyter:gpu-cuda-latest
3928
```
4029

4130
### Pull from ECR
4231
```bash
4332
# Pull image
44-
docker pull public.ecr.aws/your-alias/jupyter-gpu:latest
33+
docker pull public.ecr.aws/o0g3m8o6/codio-jupyter:gpu-cuda-latest
4534

4635
# Or use specific version
47-
docker pull public.ecr.aws/your-alias/jupyter-gpu:20260120-123456
36+
docker pull public.ecr.aws/o0g3m8o6/codio-jupyter:gpu-cuda-20260120
4837
```
4938

5039
## Local Development
5140

5241
### Build locally
5342
```bash
5443
cd gpu
55-
docker build -t jupyter-gpu:latest .
44+
docker build -t codio-jupyter:gpu-cuda-latest .
5645
```
5746

5847
### Test locally
5948
```bash
6049
docker run --gpus all -p 8888:8888 \
6150
-v $(pwd)/notebooks:/home/jovyan/work \
62-
jupyter-gpu:latest
51+
codio-jupyter:gpu-cuda-latest
6352
```
6453

6554
## Customization

standard/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM quay.io/jupyter/base-notebook:x86_64-python-3.13
2+
3+
USER root
4+
5+
# Install system dependencies
6+
RUN apt-get update && apt-get install -y \
7+
git \
8+
wget \
9+
build-essential \
10+
&& apt-get clean \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
USER ${NB_UID}
14+
15+
# Copy requirements and install Python packages
16+
COPY --chown=${NB_UID}:${NB_GID} requirements.txt /tmp/
17+
RUN pip install --no-cache-dir -r /tmp/requirements.txt
18+
19+
# Expose Jupyter port
20+
EXPOSE 8888

standard/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Jupyter GPU Docker Image
2+
3+
Docker image for Jupyter Notebook.
4+
5+
## Base Image
6+
- `quay.io/jupyter/base-notebook:latest`
7+
8+
9+
### Workflow Triggers
10+
- Push to `master` branch with changes in `standard/` directory
11+
- Pull requests (excludes timestamped tags)
12+
13+
## Running the Image
14+
15+
### Local with GPU
16+
```bash
17+
docker run --gpus all -p 8888:8888 \
18+
-v $(pwd)/notebooks:/home/jovyan/work \
19+
public.ecr.aws/o0g3m8o6/codio-jupyter:standard-latest
20+
```
21+
22+
### Pull from ECR
23+
```bash
24+
# Pull image
25+
docker pull public.ecr.aws/o0g3m8o6/codio-jupyter:standard-latest
26+
27+
# Or use specific version
28+
docker pull public.ecr.aws/o0g3m8o6/codio-jupyter:standard-20260120
29+
```
30+
31+
## Local Development
32+
33+
### Build locally
34+
```bash
35+
cd gpu
36+
docker build -t codio-jupyter:standard-latest .
37+
```
38+
39+
### Test locally
40+
```bash
41+
docker run --gpus all -p 8888:8888 \
42+
-v $(pwd)/notebooks:/home/jovyan/work \
43+
codio-jupyter:standard-latest
44+
```
45+
46+
## Customization
47+
Edit `requirements.txt` to add or modify Python packages, then push to trigger the workflow.

0 commit comments

Comments
 (0)