Skip to content

Commit

Permalink
feat: added docker compose files
Browse files Browse the repository at this point in the history
closes #2
  • Loading branch information
Gurkengewuerz committed Oct 25, 2024
1 parent c5e1d04 commit 66b45e5
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
49 changes: 49 additions & 0 deletions docker/compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
services:

judge:
build:
dockerfile: docker/server/Dockerfile
context: ..
restart: unless-stopped
volumes:
- ../test_cases:/test_cases
- judge:/db
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- LOG_LEVEL=5
- MAX_PARALLEL_JUDGES=5
- TESTS_PATH=/test_cases
- DB_PATH=/db
- GITEA_URL=http://gitea:3000
- GITEA_TOKEN=$GITEA_TOKEN
- GITEA_WEBHOOK_SECRET=anExampleSecret
ports:
- "3000:3000"
logging:
driver: "json-file"
options:
max-size: "512k"
max-file: "1"

gitea:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
restart: unless-stopped
volumes:
- gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3010:3000"
- "222:22"
logging:
driver: "json-file"
options:
max-size: "512k"
max-file: "1"

volumes:
judge:
gitea:
34 changes: 34 additions & 0 deletions docker/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
services:
judge:
image: ghcr.io/gurkengewuerz/gitcodejudge-server:latest
restart: unless-stopped
networks: [traefik]
volumes:
- ${CONTAINER_DIR}/judge/tests:/test_cases
- ${CONTAINER_DIR}/judge/db:/db
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- LOG_LEVEL=4
- MAX_PARALLEL_JUDGES=5
- TESTS_PATH=/test_cases
- DB_PATH=/db
- PDF_FOOTER_COPYRIGHT=Copyright by Gurkengewuerz
- GITEA_URL=$GITEA_URL
- GITEA_TOKEN=$GITEA_TOKEN
- GITEA_WEBHOOK_SECRET=$GITEA_WEBHOOK_SECRET
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.gitjudge.entrypoints=websecure"
- "traefik.http.routers.gitjudge.rule=HOST(`$VIRTUAL_HOST`)"
- "traefik.http.routers.gitjudge.service=gitjudge-srv"
- "traefik.http.services.gitjudge-srv.loadbalancer.server.port=3000"
logging:
driver: "json-file"
options:
max-size: "512k"
max-file: "1"

networks:
traefik:
external: true
5 changes: 5 additions & 0 deletions docker/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download

RUN mkdir -p /dummy

COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build -o /server ./cmd/main.go

# Deploy the application binary into a lean image
FROM gcr.io/distroless/base-debian11 AS build-release-stage
SHELL ["/busybox/sh", "-c"]

WORKDIR /

COPY --from=build-stage /server /server
COPY --from=build-stage --chown=nonroot:nonroot /dummy /db
COPY --from=build-stage --chown=nonroot:nonroot /dummy /test_cases

EXPOSE 3000

Expand Down

0 comments on commit 66b45e5

Please sign in to comment.