Skip to content

Commit 2510b7b

Browse files
committed
build app on push to main using docker image
1 parent 3db8a15 commit 2510b7b

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
env:
10+
DOCKER_IMAGE: icrsc/nextflow-app
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Login to Docker Hub
23+
uses: docker/login-action@v3
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_TOKEN }}
27+
28+
- name: Build and push
29+
uses: docker/build-push-action@v5
30+
with:
31+
context: .
32+
push: true
33+
tags: |
34+
${{ env.DOCKER_IMAGE }}:latest
35+
${{ env.DOCKER_IMAGE }}:${{ github.sha }}
36+
37+
- name: Image digest
38+
run: echo ${{ steps.docker_build.outputs.digest }}

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Use an official Python runtime as the base image
2+
FROM python:3.10
3+
4+
# Set the working directory in the container
5+
WORKDIR /app
6+
7+
# Copy the current directory contents into the container at /app
8+
COPY . /app
9+
10+
# Install system dependencies
11+
RUN apt-get update && apt-get install -y \
12+
build-essential \
13+
&& apt-get clean \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
# Create and activate virtual environment
17+
RUN python -m venv .nf-env
18+
ENV PATH="/app/.nf-env/bin:$PATH"
19+
20+
# Install Python dependencies
21+
RUN pip install --upgrade pip
22+
RUN pip install -r requirements.txt
23+
24+
# Make port 8501 available to the world outside this container
25+
EXPOSE 8501
26+
27+
# Run streamlit when the container launches
28+
CMD ["streamlit", "run", "index.py"]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pandas==2.2.3
22
paramiko==3.5.0
33
streamlit==1.39.0
4+
pre-commit==4.0.1

0 commit comments

Comments
 (0)