From 9a1cc3a6306176767f2bdf7715fdd28ca8639bd2 Mon Sep 17 00:00:00 2001 From: slhmy Date: Tue, 1 Oct 2024 11:33:57 +0800 Subject: [PATCH] Prepare docker deploy --- .github/workflows/docker-publish-platform.yml | 4 ++++ .gitignore | 2 +- Dockerfile | 9 ++++++--- Makefile | 2 +- docker-compose.yml | 14 +++++++++++++- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-publish-platform.yml b/.github/workflows/docker-publish-platform.yml index e6c6afb..1f7c224 100644 --- a/.github/workflows/docker-publish-platform.yml +++ b/.github/workflows/docker-publish-platform.yml @@ -35,6 +35,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Get Frontend dist + run: | + make update-front + # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer - name: Install cosign diff --git a/.gitignore b/.gitignore index a3486f8..5b2af24 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ bin/ __debug_bin** # Ignore override config files -override.* +*override.* !override.example.toml frontend/ diff --git a/Dockerfile b/Dockerfile index c688bc5..f3d08cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,16 +11,19 @@ RUN make get-front FROM ubuntu:latest +RUN apt update && apt install -y ca-certificates curl +RUN update-ca-certificates + WORKDIR /platform COPY --from=build /workdir/bin/ /usr/local/bin/ -COPY --from=build /workdir/frontend/dist ./frontend_dist +COPY --from=build /workdir/frontend/dist frontend/dist -COPY config.toml ./config.toml +COPY config.toml config.toml ENV OJ_LAB_SERVICE_ENV='production' ENV DATABASE_DSN='user=postgres password=postgres host=host.docker.internal port=5432 dbname=oj_lab sslmode=disable TimeZone=Asia/Shanghai' -ENV REDIS_HOSTS='["host.docker.internal:6379"]' +ENV REDIS_HOSTS='host.docker.internal:6379' ENV MINIO_ENDPOINT='http://host.docker.internal:9000' ENV SERVICE_MODE="release" diff --git a/Makefile b/Makefile index cbcc67a..68324c9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ OS := $(shell uname -s) FRONTEND_DIST_DIR := frontend/dist -FRONTEND_DIST_URL := https://github.com/oj-lab/frontend/releases/download/v0.0.3/dist.zip +FRONTEND_DIST_URL := https://github.com/oj-lab/frontend/releases/download/v0.1.0/dist.zip ICPC_PROBLEM_PACKAGES_DIR := problem-packages/icpc ICPC_PROBLEM_PACKAGES_URL := https://github.com/oj-lab/problem-packages/releases/download/v0.0.1/icpc_problem.zip diff --git a/docker-compose.yml b/docker-compose.yml index ee89a0e..6e2e432 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,5 +57,17 @@ services: - "host.docker.internal:host-gateway" environment: - ENABLE_RCLONE=true + - INTERNAL_TOKEN=internal_token ports: - - 8000:8000 \ No newline at end of file + - 8000:8000 + + platform: + image: ghcr.io/oj-lab/platform:main + pull_policy: always + extra_hosts: + - "host.docker.internal:host-gateway" + ports: + - 8080:8080 + volumes: + - ./frontend:/platform/frontend + - ./override.docker.toml:/platform/override.toml \ No newline at end of file