Skip to content

Commit

Permalink
Prepare docker deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
slhmy committed Oct 1, 2024
1 parent 7e83979 commit 1035ddc
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docker-publish-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bin/
__debug_bin**

# Ignore override config files
override.*
*override.*
!override.example.toml

frontend/
Expand Down
4 changes: 2 additions & 2 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
oj-lab.online {
tls oj-lab.online.pem oj-lab.online.key
www.oj-lab.online {
tls www.oj-lab.online.pem www.oj-lab.online.key
reverse_proxy localhost:8080
}
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 13 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,17 @@ services:
- "host.docker.internal:host-gateway"
environment:
- ENABLE_RCLONE=true
- INTERNAL_TOKEN=internal_token
ports:
- 8000:8000
- 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

0 comments on commit 1035ddc

Please sign in to comment.