Skip to content

Commit 99424d9

Browse files
authored
Initial commit
0 parents  commit 99424d9

25 files changed

+48473
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Publishes docker image, pinning actions to a commit SHA,
2+
# and updating most recently built image with the latest tag.
3+
# Can be triggered by either pushing a commit that changes the `Dockerfile`,
4+
# or manually dispatching the workflow.
5+
6+
name: Publish Docker image
7+
8+
on:
9+
workflow_dispatch:
10+
push:
11+
paths:
12+
- 'Dockerfile'
13+
- 'conda-linux-64.lock'
14+
15+
jobs:
16+
push_to_registry:
17+
name: Push Docker image to Docker Hub
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check out the repo
21+
uses: actions/checkout@v4
22+
23+
- name: Log in to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
29+
- name: Extract metadata (tags, labels) for Docker
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: skysheng7/ia4
34+
tags: |
35+
type=raw, value={{sha}},enable=${{github.ref_type != 'tag' }}
36+
type=raw, value=latest
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: .
42+
file: ./Dockerfile
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}
46+
47+
- name: Update docker-compose.yml with new image tag
48+
if: success()
49+
run: |
50+
sed -i "s|image: skysheng7/ia4:.*|image: skysheng7/ia4:${{ steps.meta.outputs.version }}|" docker-compose.yml
51+
52+
- name: Commit and push updated docker-compose.yml
53+
if: success()
54+
run: |
55+
git config --global user.name "github-actions[bot]"
56+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
57+
git add docker-compose.yml
58+
git commit -m "Update docker-compose.yml with new image tag"
59+
git push

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**.DS_Store
2+
**.ipynb_checkpoints/
3+
**.virtual_documents/

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# build on top of template of minimal notebook
2+
FROM continuumio/miniconda3:25.3.1-1
3+
4+
# copy all conda environment dependencies
5+
COPY conda-lock.yml /tmp/conda-lock.yml
6+
7+
# Install conda-lock and create environment from lock file
8+
RUN conda install -n base -c conda-forge conda-lock -y \
9+
&& conda-lock install --name ia4 /tmp/conda-lock.yml \
10+
&& conda clean --all -y -f
11+
12+
# conda activate the environment
13+
RUN conda init bash \
14+
&& echo "conda activate ia4" >> ~/.bashrc
15+
16+
# install make file
17+
RUN apt-get update \
18+
&& apt-get install -y build-essential \
19+
&& apt-get install -y nano \
20+
&& apt-get clean \
21+
&& rm -rf /var/lib/apt/lists/*
22+
23+

LICENSE.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
layout: page
3+
title: "Licenses"
4+
root: .
5+
---
6+
## Instructional Material
7+
8+
All Software Carpentry and Data Carpentry instructional material is
9+
made available under the [Creative Commons Attribution
10+
license][cc-by-human]. The following is a human-readable summary of
11+
(and not a substitute for) the [full legal text of the CC BY 4.0
12+
license][cc-by-legal].
13+
14+
You are free:
15+
16+
* to **Share**---copy and redistribute the material in any medium or format
17+
* to **Adapt**---remix, transform, and build upon the material
18+
19+
for any purpose, even commercially.
20+
21+
The licensor cannot revoke these freedoms as long as you follow the
22+
license terms.
23+
24+
Under the following terms:
25+
26+
* **Attribution**---You must give appropriate credit (mentioning that
27+
your work is derived from work that is Copyright © Software
28+
Carpentry and, where practical, linking to
29+
http://software-carpentry.org/), provide a [link to the
30+
license][cc-by-human], and indicate if changes were made. You may do
31+
so in any reasonable manner, but not in any way that suggests the
32+
licensor endorses you or your use.
33+
34+
**No additional restrictions**---You may not apply legal terms or
35+
technological measures that legally restrict others from doing
36+
anything the license permits. With the understanding that:
37+
38+
Notices:
39+
40+
* You do not have to comply with the license for elements of the
41+
material in the public domain or where your use is permitted by an
42+
applicable exception or limitation.
43+
* No warranties are given. The license may not give you all of the
44+
permissions necessary for your intended use. For example, other
45+
rights such as publicity, privacy, or moral rights may limit how you
46+
use the material.
47+
48+
## Software
49+
50+
Except where otherwise noted, the example programs and other software
51+
provided by Software Carpentry and Data Carpentry are made available under the
52+
[OSI][osi]-approved
53+
[MIT license][mit-license].
54+
55+
Permission is hereby granted, free of charge, to any person obtaining
56+
a copy of this software and associated documentation files (the
57+
"Software"), to deal in the Software without restriction, including
58+
without limitation the rights to use, copy, modify, merge, publish,
59+
distribute, sublicense, and/or sell copies of the Software, and to
60+
permit persons to whom the Software is furnished to do so, subject to
61+
the following conditions:
62+
63+
The above copyright notice and this permission notice shall be
64+
included in all copies or substantial portions of the Software.
65+
66+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
67+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
68+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
69+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
70+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
71+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
72+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
73+
74+
## Trademark
75+
76+
"Software Carpentry" and "Data Carpentry" and their respective logos
77+
are registered trademarks of [Community Initiatives][CI].
78+
79+
[cc-by-human]: https://creativecommons.org/licenses/by/4.0/
80+
[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode
81+
[mit-license]: https://opensource.org/licenses/mit-license.html
82+
[ci]: http://communityin.org/
83+
[osi]: https://opensource.org

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Building a Data Analysis pipeline tutorial
2+
adapted from [Software Carpentry](http://software-carpentry.org/)
3+
4+
This example data analysis project analyzes the word count for all words in 4
5+
novels. It reports the top 10 most occurring words in each book in a [report](doc/count_report.qmd).
6+
7+
---
8+
9+
## Recreate the computational environment
10+
11+
### 1. Clone repo
12+
13+
Clone this repo, and using the command line, navigate to the root of this project.
14+
15+
```bash
16+
git clone <repo_name>
17+
cd <folder_name>
18+
```
19+
20+
### 2. Recreate the computational environment
21+
22+
<details>
23+
<summary><b>Option 1: Use `conda-lock.yml`</b></summary>
24+
25+
2.1.1 Run the following commands to create the conda environment:
26+
27+
```
28+
conda-lock install --name ia4 conda-lock.yml
29+
```
30+
31+
2.1.2 Activate the conda environment:
32+
33+
```
34+
conda activate ia4
35+
```
36+
37+
2.1.3 Run the analysis:
38+
39+
```
40+
bash runall.sh
41+
```
42+
43+
</details>
44+
45+
<details>
46+
<summary><b>Option 2: Use `environment.yml`</b></summary>
47+
48+
2.2.1 Create a conda environment using `environment.yml`
49+
50+
```bash
51+
conda env create -n ia4 -f environment.yml
52+
```
53+
54+
2.2.2 Activate the conda environment:
55+
56+
```
57+
conda activate ia4
58+
```
59+
60+
2.2.3 Run the analysis:
61+
62+
```
63+
bash runall.sh
64+
```
65+
66+
</details>
67+
68+
<details>
69+
<summary><b>Option 3: Use `docker-compose.yml`</b></summary>
70+
71+
2.3.1. Pull and launch the docker container, this will direct you to the terminal of the container, no GUI
72+
73+
```bash
74+
docker compose run --rm ia4
75+
```
76+
77+
2.3.3 You will land directly in the terminal of the container. Run the analysis:
78+
79+
```
80+
bash runall.sh
81+
```
82+
83+
2.3.4 After you are done, type `exit` to leave docker container.
84+
85+
</details>
86+
87+
---
88+
89+
## Exercise:
90+
91+
Your task is to add a "smarter" data analysis pipeline using GNU Make!
92+
It should accomplish the same task as `bash runall.sh` when you type
93+
`make all`.
94+
95+
It should reset the analysis the starting point
96+
(the state when you first copied this repo)
97+
when you type `make clean`.
98+
99+
---
100+
101+
### Depenedencies
102+
- GNU Make
103+
- Quarto
104+
- Python & Python libraries:
105+
- `click`
106+
- `matplotlib`
107+
- `pandas`

0 commit comments

Comments
 (0)