Skip to content

Commit

Permalink
chore: test docker cache
Browse files Browse the repository at this point in the history
  • Loading branch information
khorshuheng committed Feb 21, 2025
1 parent 884ecf7 commit 2686487
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 31 deletions.
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ spec.yaml
target/
deploy/
tests/
docker/Dockerfile
scripts/
**/Dockerfile
script/
.github/
doc/
57 changes: 31 additions & 26 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,40 @@ env:

jobs:
setup:
name: Setup Environment
name: 'Build CI image: ${{ matrix.service_name }}'
runs-on: ubuntu-latest
strategy:
matrix:
include:
- docker_file_path: "Dockerfile"
service_name: "appflowy_cloud"
- docker_file_path: "./services/appflowy-worker/Dockerfile"
service_name: "appflowy_worker"
- docker_file_path: "./admin_frontend/Dockerfile"
service_name: "admin_frontend"
steps:
- uses: actions/checkout@v4
- name: Install prerequisites
run: |
sudo apt-get update
sudo apt-get install protobuf-compiler
sudo update-ca-certificates
- name: Build Docker Images
run: |
export DOCKER_DEFAULT_PLATFORM=linux/amd64
cp deploy.env .env
docker compose build appflowy_cloud appflowy_worker admin_frontend
- name: Push docker images to docker hub
run: |
docker tag appflowyinc/appflowy_cloud appflowyinc/appflowy_cloud:${GITHUB_SHA}
docker tag appflowyinc/appflowy_worker appflowyinc/appflowy_worker:${GITHUB_SHA}
docker tag appflowyinc/admin_frontend appflowyinc/admin_frontend:${GITHUB_SHA}
echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login --username appflowyinc --password-stdin
docker push appflowyinc/appflowy_cloud:${GITHUB_SHA}
docker push appflowyinc/appflowy_worker:${GITHUB_SHA}
docker push appflowyinc/admin_frontend:${GITHUB_SHA}
APPFLOWY_WORKER_VERSION=${GITHUB_SHA}
APPFLOWY_CLOUD_VERSION=${GITHUB_SHA}
APPFLOWY_ADMIN_FRONTEND_VERSION=${GITHUB_SHA}
with:
fetch-depth: 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push ${{ matrix.service_name }}
uses: docker/build-push-action@v5
with:
push: true
file: ${{ matrix.docker_file_path }}
tags: |
${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.service_name }}:${{ github.sha }}
build-args: |
PROFILE=release
FEATURES=
cache-from: type=gha
cache-to: type=gha,mode=max

test:
name: Integration Tests
Expand All @@ -81,7 +87,6 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
workspaces: "AppFlowy-Cloud"

- name: Copy and rename deploy.env to .env
run: cp deploy.env .env
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ ARG PROFILE="release"

COPY --from=planner /app/recipe.json recipe.json
# Build our project dependencies
ENV CARGO_BUILD_JOBS=4
RUN cargo chef cook --release --recipe-path recipe.json

COPY . .
ENV SQLX_OFFLINE true

# Build the project
RUN echo "Building with profile: ${PROFILE}, features: ${FEATURES}, "
ENV CARGO_INCREMENTAL=false
RUN cargo build --profile=${PROFILE} --features "${FEATURES}" --bin appflowy_cloud

FROM debian:bookworm-slim AS runtime
Expand Down
2 changes: 1 addition & 1 deletion src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Application {
self.port
}
}

// "test"
pub async fn run_actix_server(
listener: TcpListener,
state: AppState,
Expand Down
1 change: 1 addition & 0 deletions src/biz/access_request/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use shared_entity::dto::access_request_dto::{AccessRequest, AccessRequestView};
use sqlx::PgPool;
use uuid::Uuid;

// Test
pub async fn create_access_request(
pg_pool: &PgPool,
mailer: AFCloudMailer,
Expand Down
2 changes: 1 addition & 1 deletion src/biz/chat/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl AIMetrics {
let metrics = Self::default();
let realtime_registry = registry.sub_registry_with_prefix("ai");

// Register each metric with the Prometheus registry
// (test) Register each metric with the Prometheus registry
realtime_registry.register(
"total_stream_count",
"Total count of streams processed",
Expand Down

0 comments on commit 2686487

Please sign in to comment.