Skip to content

Commit 3399a24

Browse files
authored
Merge pull request #12 from StatFunGen/add_docker
Add docker workflow
2 parents 50ef27a + c8c2dff commit 3399a24

5 files changed

Lines changed: 122 additions & 3 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build containers
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'docker/Dockerfile'
7+
- 'docker/entrypoint.sh'
8+
9+
jobs:
10+
docker_container:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
15+
steps:
16+
- name: Checkout pull request branch
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Free Disk Space (Ubuntu)
22+
uses: jlumbroso/free-disk-space@main
23+
24+
- name: Setup up docker buildx
25+
uses: docker/setup-buildx-action@v2
26+
27+
- name: Build docker containers
28+
uses: docker/build-push-action@v6
29+
with:
30+
context: docker
31+
tags: tmate-minimal:latest
32+
outputs: type=image,compression=zstd
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Push containers to registries
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
paths:
7+
- 'docker/Dockerfile'
8+
- 'docker/entrypoint.sh'
9+
10+
jobs:
11+
push_docker_containers:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout pull request branch
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Free Disk Space (Ubuntu)
26+
uses: jlumbroso/free-disk-space@main
27+
28+
- name: Setup up docker buildx
29+
uses: docker/setup-buildx-action@v2
30+
31+
- name: Log in to ghcr.io with docker
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.repository_owner }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Build and push docker containers
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: docker
42+
push: true
43+
tags: |
44+
ghcr.io/${{ github.repository_owner }}/tmate-minimal:latest
45+
outputs: type=image,compression=zstd,push=true
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Push containers to registries
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
push_docker_containers:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- name: Checkout pull request branch
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Free Disk Space (Ubuntu)
22+
uses: jlumbroso/free-disk-space@main
23+
24+
- name: Setup up docker buildx
25+
uses: docker/setup-buildx-action@v2
26+
27+
- name: Log in to ghcr.io with docker
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.repository_owner }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Build and push docker containers
35+
uses: docker/build-push-action@v6
36+
with:
37+
context: docker
38+
push: true
39+
tags: |
40+
ghcr.io/${{ github.repository_owner }}/tmate-minimal:latest
41+
outputs: type=image,compression=zstd,push=true

docker/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ USER root
55
# libgomp1 is needed for FINEMAP, which is precompiled and breaks with RPATH relocation
66
# tmate is needed so that SSH access is possible
77
# curl is needed to bootstrap pixi
8+
# DO NOT add other packages here unless specifically told to- dependencies should be managed by pixi
89
RUN apt-get update && apt-get -y install ca-certificates tzdata libgl1 libgomp1 tmate curl
910

1011
# Use bash as default shell instead of dash
1112
RUN ln -sf /bin/bash /bin/sh
13+
RUN usermod -a -G users ubuntu
1214

1315
# RUN useradd --no-log-init --create-home --shell /bin/bash --uid 2000 --no-user-group jovyan
1416
COPY --chown=ubuntu --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh

docker/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Minimal VM image for mmcloud
22

3-
This image is designed to work for mmcloud as the base image where we add additional package on the fly.
3+
This image is designed to work for mmcloud as the base image where we add additional package on the fly. Instead of the typical approach of installing software into a container, we install our software into an AWS FSx volume with pixi and mount this volume into the container at run time. This greatly reduces the startup time for jobs as well as the EBS volume storage requirements for the host VM.
44

5-
- The image is maintained in the long run at https://github.com/danielnachun/misc-containers/tree/main/tmate-minimal. Please check that repo for the latest version
6-
- To use this image in mmcloud please check this page: https://wanggroup.org/productivity_tips/mmcloud-interactive
5+
To use this image in mmcloud please check this page: https://wanggroup.org/productivity_tips/mmcloud-interactive

0 commit comments

Comments
 (0)