Skip to content

Commit 4af11b5

Browse files
authored
Add publish to dockerhub github action (#26)
* Add publish to dockerhub github action * Rename variables and branch for test * Remove branch and PR from meta tags * Remove prefix tag * Substitute tags with repo name/image name * Remove hardcoded env * Push test image name * Move .env.docker to .env in github action * Add 44 char long encryption key * Add AUTH_SECRET example * Make AUTH_SECRET 44 char length * Restore liblab hub variable values * Reorder AUTH_SECRET to be above encryption key
1 parent 46c443e commit 4af11b5

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

.env.docker

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Client public env vars
2+
NEXT_PUBLIC_ENV_NAME=local
3+
NEXT_PUBLIC_LOG_LEVEL=debug
4+
NEXT_PUBLIC_POSTHOG_KEY=phc_C1L7Idffoa2oRT54XZDGh4GSdOPFgzliJiusFnVV8Wz
5+
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
6+
NEXT_PUBLIC_DISABLE_TELEMETRY=false
7+
8+
# Server private env vars
9+
LICENSE_KEY=free
10+
BASE_URL=http://localhost:3000
11+
STORAGE_TYPE=FILE_SYSTEM
12+
STARTER=next
13+
AUTH_SECRET='some44charactersstringsome44charactersstring'
14+
ENCRYPTION_KEY='some44charactersstringsome44charactersstring'
15+
NGROK_AUTHTOKEN='example'
16+
17+
# Available providers: AmazonBedrock, Anthropic, Cohere, Deepseek, Github, Google, Groq, HuggingFace, Hyperbolic, LMStudio, Mistral, Ollama, OpenAI, OpenAILike, OpenRouter, Perplexity, Together, xAI
18+
DEFAULT_LLM_PROVIDER=Anthropic
19+
DEFAULT_LLM_MODEL=claude-4-sonnet-20250514
20+
21+
# Get your Anthropic API Key in your account settings - https://console.anthropic.com/settings/keys
22+
ANTHROPIC_API_KEY='example'
23+
24+
# Provide the Netlify token to enable app deployment
25+
NETLIFY_AUTH_TOKEN='example'

.github/workflows/docker-build.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
DOCKER_REGISTRY: docker.io
13+
DOCKER_IMAGE_NAME: liblab/liblab-ai
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Create .env file for Docker build
30+
run: |
31+
mv .env.docker .env
32+
33+
- name: Log in to Container Registry
34+
if: github.event_name == 'push'
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ${{ env.DOCKER_REGISTRY }}
38+
username: ${{ secrets.DOCKER_USERNAME }}
39+
password: ${{ secrets.DOCKER_PASSWORD }}
40+
41+
- name: Extract metadata
42+
id: meta
43+
uses: docker/metadata-action@v5
44+
with:
45+
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
46+
tags: |
47+
type=semver,pattern={{version}}
48+
type=semver,pattern={{major}}.{{minor}}
49+
type=raw,value=latest,enable={{is_default_branch}}
50+
51+
- name: Build and push Docker image
52+
uses: docker/build-push-action@v5
53+
with:
54+
context: .
55+
file: ./Dockerfile
56+
push: ${{ github.event_name == 'push' }}
57+
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max

docker-compose.dev.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ services:
3535
# Exclude node_modules and .next to use container's version
3636
- /app/node_modules
3737
- /app/.next
38+
env_file:
39+
- '.env'
3840
environment:
3941
- NODE_ENV=development
4042
- DATABASE_URL=postgresql://liblab:liblab_password@postgres:5432/liblab

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ services:
2929
depends_on:
3030
postgres:
3131
condition: service_healthy
32+
env_file:
33+
- '.env'
3234
environment:
3335
- DATABASE_URL=postgresql://liblab:liblab_password@postgres:5432/liblab
3436

0 commit comments

Comments
 (0)