Skip to content

Commit e47cffe

Browse files
authored
Merge pull request #13 from unmtransinfo/prod-deploy
integrate ci/cd pipeline.
2 parents 2150187 + 16c4bee commit e47cffe

2 files changed

Lines changed: 96 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-and-push:
10+
name: Build & Push UI Image
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout Code
15+
uses: actions/checkout@v4
16+
17+
# --- Step to restore untracked proprietary dependencies ---
18+
- name: Restore Proprietary Dependencies (Base64)
19+
if: "${{ secrets.LIBS_TGZ_BASE64 != '' }}"
20+
run: |
21+
echo "Restoring libs/ folder from LIBS_TGZ_BASE64 secret..."
22+
echo "${{ secrets.LIBS_TGZ_BASE64 }}" | base64 --decode | tar -xzf -
23+
24+
- name: Restore Proprietary Dependencies (Signed URL)
25+
if: "${{ secrets.LIBS_DOWNLOAD_URL != '' && secrets.LIBS_TGZ_BASE64 == '' }}"
26+
run: |
27+
echo "Downloading libs/ archive from LIBS_DOWNLOAD_URL secret..."
28+
curl -sSL -o libs.tar.gz "${{ secrets.LIBS_DOWNLOAD_URL }}"
29+
tar -xzf libs.tar.gz
30+
rm -f libs.tar.gz
31+
32+
- name: Check libs/ Directory Structure
33+
run: |
34+
if [ -d "libs" ]; then
35+
echo "libs/ directory found. Number of files:"
36+
ls -1 libs/ | wc -l
37+
else
38+
echo "WARNING: libs/ directory not found! Docker build will likely fail."
39+
fi
40+
41+
# --- Set up Docker Buildx ---
42+
- name: Set up QEMU
43+
uses: docker/setup-qemu-action@v3
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
# --- Log in to Docker Hub ---
49+
- name: Log in to Docker Hub
50+
uses: docker/login-action@v3
51+
with:
52+
username: ${{ secrets.DOCKERHUB_USERNAME }}
53+
password: ${{ secrets.DOCKERHUB_TOKEN }}
54+
55+
# --- Build and Push ---
56+
- name: Build and Push Docker Image
57+
uses: docker/build-push-action@v6
58+
with:
59+
context: .
60+
file: ./Dockerfile
61+
push: true
62+
tags: |
63+
unmtransinfo/carlsbad_ui:latest
64+
unmtransinfo/carlsbad_ui:${{ github.sha }}
65+
cache-from: type=gha
66+
cache-to: type=gha,mode=max

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,33 @@ Docker\_UI container may be served via Apache-proxy configured thus:
169169
ProxyPass /carlsbad http://localhost:9091/carlsbad
170170
ProxyPassReverse /carlsbad http://localhost:9091/carlsbad
171171
```
172+
173+
## GitHub Actions CI/CD
174+
175+
An automated GitHub Actions workflow is set up to build and push the `carlsbad_ui` Docker image to Docker Hub whenever changes are merged into the `master` branch.
176+
177+
The workflow is defined in [.github/workflows/docker-publish.yml](file:///Users/bivek/Desktop/CARLSBAD/.github/workflows/docker-publish.yml).
178+
179+
### Required GitHub Secrets
180+
181+
To allow the workflow to successfully build the Docker image and push to Docker Hub, you must configure the following **Repository Secrets** in your GitHub repository (`Settings > Secrets and variables > Actions > Repository secrets`):
182+
183+
#### 1. Docker Hub Credentials
184+
* `DOCKERHUB_USERNAME`: Your Docker Hub username or organization name.
185+
* `DOCKERHUB_TOKEN`: A Personal Access Token (PAT) created under your Docker Hub Account settings.
186+
187+
#### 2. Proprietary Dependencies (`libs/`) (One of the following is required)
188+
Because the `libs/` directory containing ChemAxon and UNM SNAPSHOT libraries is untracked by Git, you must supply it in the CI runner:
189+
190+
* **Option A (Recommended - Base64 Secret):**
191+
Compress your local `libs/` directory into a tarball, base64-encode it, and save the resulting string as `LIBS_TGZ_BASE64` in GitHub Secrets.
192+
193+
You can generate this base64 string using:
194+
```bash
195+
tar -czf - libs/ | base64 | pbcopy
196+
```
197+
*(Paste the copied string directly into the secret value)*
198+
199+
* **Option B (Secure Download URL):**
200+
Upload a compressed archive of `libs/` to a secure/private cloud storage bucket (AWS S3, Google Cloud Storage, etc.) and save the secure signed URL as a secret named `LIBS_DOWNLOAD_URL`.
201+

0 commit comments

Comments
 (0)