Skip to content

Commit 2686487

Browse files
committed
chore: test docker cache
1 parent 884ecf7 commit 2686487

File tree

6 files changed

+39
-31
lines changed

6 files changed

+39
-31
lines changed

.dockerignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ spec.yaml
55
target/
66
deploy/
77
tests/
8-
docker/Dockerfile
9-
scripts/
8+
**/Dockerfile
9+
script/
10+
.github/
11+
doc/

.github/workflows/integration_test.yml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,40 @@ env:
3333

3434
jobs:
3535
setup:
36-
name: Setup Environment
36+
name: 'Build CI image: ${{ matrix.service_name }}'
3737
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
include:
41+
- docker_file_path: "Dockerfile"
42+
service_name: "appflowy_cloud"
43+
- docker_file_path: "./services/appflowy-worker/Dockerfile"
44+
service_name: "appflowy_worker"
45+
- docker_file_path: "./admin_frontend/Dockerfile"
46+
service_name: "admin_frontend"
3847
steps:
3948
- uses: actions/checkout@v4
40-
- name: Install prerequisites
41-
run: |
42-
sudo apt-get update
43-
sudo apt-get install protobuf-compiler
44-
sudo update-ca-certificates
45-
46-
- name: Build Docker Images
47-
run: |
48-
export DOCKER_DEFAULT_PLATFORM=linux/amd64
49-
cp deploy.env .env
50-
docker compose build appflowy_cloud appflowy_worker admin_frontend
51-
52-
- name: Push docker images to docker hub
53-
run: |
54-
docker tag appflowyinc/appflowy_cloud appflowyinc/appflowy_cloud:${GITHUB_SHA}
55-
docker tag appflowyinc/appflowy_worker appflowyinc/appflowy_worker:${GITHUB_SHA}
56-
docker tag appflowyinc/admin_frontend appflowyinc/admin_frontend:${GITHUB_SHA}
57-
echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login --username appflowyinc --password-stdin
58-
docker push appflowyinc/appflowy_cloud:${GITHUB_SHA}
59-
docker push appflowyinc/appflowy_worker:${GITHUB_SHA}
60-
docker push appflowyinc/admin_frontend:${GITHUB_SHA}
61-
APPFLOWY_WORKER_VERSION=${GITHUB_SHA}
62-
APPFLOWY_CLOUD_VERSION=${GITHUB_SHA}
63-
APPFLOWY_ADMIN_FRONTEND_VERSION=${GITHUB_SHA}
49+
with:
50+
fetch-depth: 1
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v3
53+
- name: Log in to Docker Hub
54+
uses: docker/login-action@v3
55+
with:
56+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
57+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
58+
- name: Build and push ${{ matrix.service_name }}
59+
uses: docker/build-push-action@v5
60+
with:
61+
push: true
62+
file: ${{ matrix.docker_file_path }}
63+
tags: |
64+
${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.service_name }}:${{ github.sha }}
65+
build-args: |
66+
PROFILE=release
67+
FEATURES=
68+
cache-from: type=gha
69+
cache-to: type=gha,mode=max
6470

6571
test:
6672
name: Integration Tests
@@ -81,7 +87,6 @@ jobs:
8187
- uses: Swatinem/rust-cache@v2
8288
with:
8389
toolchain: ${{ env.RUST_TOOLCHAIN }}
84-
workspaces: "AppFlowy-Cloud"
8590

8691
- name: Copy and rename deploy.env to .env
8792
run: cp deploy.env .env

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ ARG PROFILE="release"
2020

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

2625
COPY . .
2726
ENV SQLX_OFFLINE true
2827

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

3333
FROM debian:bookworm-slim AS runtime

src/application.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Application {
100100
self.port
101101
}
102102
}
103-
103+
// "test"
104104
pub async fn run_actix_server(
105105
listener: TcpListener,
106106
state: AppState,

src/biz/access_request/ops.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use shared_entity::dto::access_request_dto::{AccessRequest, AccessRequestView};
2424
use sqlx::PgPool;
2525
use uuid::Uuid;
2626

27+
// Test
2728
pub async fn create_access_request(
2829
pg_pool: &PgPool,
2930
mailer: AFCloudMailer,

src/biz/chat/metrics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl AIMetrics {
1515
let metrics = Self::default();
1616
let realtime_registry = registry.sub_registry_with_prefix("ai");
1717

18-
// Register each metric with the Prometheus registry
18+
// (test) Register each metric with the Prometheus registry
1919
realtime_registry.register(
2020
"total_stream_count",
2121
"Total count of streams processed",

0 commit comments

Comments
 (0)