Skip to content

Commit f3dc8ca

Browse files
authored
update Dockerfile for GH actions (#51)
1 parent 879df5e commit f3dc8ca

3 files changed

Lines changed: 60 additions & 61 deletions

File tree

.github/workflows/docker.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build & Push CUDA Image (GHCR)
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ] # build on version tags, e.g. v1.2.3
7+
workflow_dispatch: {} # allow manual runs
8+
9+
permissions:
10+
contents: read
11+
packages: write # REQUIRED for ghcr.io
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up QEMU (for cross-arch emulation)
22+
uses: docker/setup-qemu-action@v3
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Log in to GHCR
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Extract metadata (tags, labels)
35+
id: meta
36+
uses: docker/metadata-action@v5
37+
with:
38+
images: ghcr.io/${{ github.repository }}
39+
tags: |
40+
type=ref,event=branch
41+
type=ref,event=tag
42+
type=sha
43+
44+
- name: Build & Push
45+
uses: docker/build-push-action@v6
46+
with:
47+
context: .
48+
file: ./Dockerfile # change if your Dockerfile path differs
49+
platforms: linux/amd64 # most HPC nodes are amd64; add linux/arm64 if needed
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}
53+
cache-from: type=gha
54+
cache-to: type=gha,mode=max

.github/workflows/sync.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

Dockerfile

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,13 @@
1-
# Use official PyTorch image with CUDA 12.4
1+
# syntax=docker/dockerfile:1
22
FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime
3-
4-
LABEL maintainer="logan-blaine"
5-
LABEL description="Docker image for PerTurbo with PyTorch and CUDA 12.4"
6-
73
WORKDIR /app
8-
9-
# Avoid interactive prompts
104
ENV DEBIAN_FRONTEND=noninteractive
11-
12-
# Install system packages
13-
RUN apt-get update && apt-get install -y --no-install-recommends \
14-
git \
15-
curl \
16-
ca-certificates \
17-
&& rm -rf /var/lib/apt/lists/*
18-
19-
# Upgrade pip
5+
RUN apt-get update && apt-get install -y --no-install-recommends git curl ca-certificates && rm -rf /var/lib/apt/lists/*
206
RUN pip install --upgrade pip
217

22-
# Use build-time ARG with GitHub access token (only needed while private)
23-
ARG GITHUB_TOKEN
24-
RUN pip install git+https://logan-blaine:${GITHUB_TOKEN}@github.com/pinellolab/PerTurbo.git
8+
# The workflow will place PerTurbo/ alongside this Dockerfile
9+
COPY . /app/PerTurbo
10+
# (optional) avoid copying .git via .dockerignore
11+
RUN pip install /app/PerTurbo
2512

26-
# Default to Python shell
2713
CMD ["python3"]

0 commit comments

Comments
 (0)