Skip to content

Commit

Permalink
trying to publish codespace image (#233)
Browse files Browse the repository at this point in the history
* trying to publish codespace image

* triggering build

* correcting repository name

* correcting image name

* removing post create command

* build and publish action for tag or push to main
  • Loading branch information
K20shores committed Sep 5, 2024
1 parent 9e44f2f commit 8294358
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 5 deletions.
8 changes: 5 additions & 3 deletions .devcontainer/Dockerfile.codespace
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN dnf -y update \
tree \
&& dnf clean all

# COPY . /workspaces/music-box
# WORKDIR /workspaces/music-box
# RUN pip3 install -e '.[dev]'
COPY . /workspaces/music-box

WORKDIR /workspaces/music-box

RUN pip3 install -e '.[dev]'
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "MusicBox",
"dockerFile": "Dockerfile.codespace",
"image": "ghcr.io/ncar/music-box:latest",
"extensions": [
"ms-python.python",
],
"settings": {
},
"postCreateCommand": "cd /workspaces/music-box && pip3 install -e '.[dev]' && code sample_waccm_data/README.md"
"postCreateCommand": ""
}
53 changes: 53 additions & 0 deletions .github/workflows/deploy_codespaces_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and Deploy Docker Image

on:
push:
branches:
- main
tags:
- 'v*.*.*'
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/Dockerfile.codespace
push: false
tags: ghcr.io/ncar/music-box:build-temp

- name: Build and push Docker image (latest)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/Dockerfile.codespace
push: true
tags: ghcr.io/ncar/music-box:latest

- name: Build and push Docker image (tagged)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/Dockerfile.codespace
push: true
tags: ghcr.io/ncar/music-box:${{ github.ref_name }}

0 comments on commit 8294358

Please sign in to comment.