Skip to content

Commit

Permalink
remake: rust
Browse files Browse the repository at this point in the history
  • Loading branch information
ElaBosak233 committed Jul 27, 2024
1 parent 1100b98 commit 714f50c
Show file tree
Hide file tree
Showing 350 changed files with 7,999 additions and 18,954 deletions.
3 changes: 0 additions & 3 deletions .gitattributes

This file was deleted.

108 changes: 54 additions & 54 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
name: Docker Build & Push

on:
push:
workflow_dispatch:
push:
workflow_dispatch:

permissions:
contents: read
packages: write
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
repository: elabosak233/cloudsdale
ref: ${{ github.ref }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Ghcr Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: elabosak233
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub Registry
uses: docker/login-action@v3
with:
registry: docker.io
username: elabosak233
password: ${{ secrets.DOCKER_TOKEN }}

- name: Docker metadata action
uses: docker/metadata-action@v5
id: meta
with:
images: |
ghcr.io/${{ github.repository_owner }}/cloudsdale
docker.io/${{ github.repository_owner }}/cloudsdale
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,enable=true,priority=100,prefix=,suffix=,format=short
- name: Build and Push
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
push: true
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
repository: elabosak233/cloudsdale
ref: ${{ github.ref }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Ghcr Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: elabosak233
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub Registry
uses: docker/login-action@v3
with:
registry: docker.io
username: elabosak233
password: ${{ secrets.DOCKER_TOKEN }}

- name: Docker metadata action
uses: docker/metadata-action@v5
id: meta
with:
images: |
ghcr.io/${{ github.repository_owner }}/cloudsdale
docker.io/${{ github.repository_owner }}/cloudsdale
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,enable=true,priority=100,prefix=,suffix=,format=short
- name: Build and Push
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
push: true
36 changes: 16 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out
# Project
/target
/.idea
/.vscode

go.work
.idea
config.yml
logs
plugins
uploads
/media/
/configs/
/db/
/build/
/captures/
test.go
/dist/
*.lock

# Cloudsdale
/application.yml
/favicon.webp
/k8s-config.yml
/configs
/db
/media
/caputres
/logs
/dist
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CHANGELOG
65 changes: 65 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[package]
name = "cloudsdale"
version = "0.0.1"
edition = "2021"
description = "The Cloudsdale project is an open-source, light weight, Jeopardy-style's CTF platform."

[dependencies]
axum = { version = "0.7", features = [
"ws",
"http2",
"multipart",
"macros",
"tower-log",
"tracing",
"json",
] }
axum-extra = { version = "0.9", features = [
"typed-header",
"query",
"multipart",
"typed-routing",
"async-read-body",
] }
futures = { version = "^0.3" }
futures-util = { version = "^0.3" }
tokio = { version = "1.38", features = ["full"] }
tower = { version = "0.4" }
tower-http = { version = "0.5", features = ["cors", "fs", "trace"] }
serde = { version = "1.0", features = ["derive"] }
tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
uuid = { version = "1.8", features = ["v4", "fast-rng", "macro-diagnostics"] }
sea-orm = { version = "0.12", features = [
"sqlx-mysql",
"sqlx-postgres",
"sqlx-sqlite",
"debug-print",
"with-uuid",
"macros",
"with-json",
"runtime-tokio-native-tls",
] }
sea-orm-migration = { version = "0.12" }
chrono = "0.4.38"
serde_json = "1.0.117"
bollard = "*"
bcrypt = "0.15.1"
once_cell = "1.19.0"
jsonwebtoken = "9.3.0"
prometheus = "0.13.4"
regex = "1.10.5"
thiserror = "1.0.61"
mime = "0.3.17"
validator = { version = "0.18", features = ["derive"] }
openssl = { version = "0.10", features = ["vendored"] }
wsrx = { version = "0.2", features = ["server"] }
serde_yaml = "0.9.34"
kube = { version = "0.92.1", features = ["runtime", "derive"] }
k8s-openapi = { version = "0.22.0", features = ["latest"] }
reqwest = { version = "0.12", features = ["json"] }
async-trait = "0.1.81"

[[bin]]
name = "cloudsdale"
path = "src/main.rs"
37 changes: 23 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
FROM golang:1.22-alpine AS backend
FROM rust:latest AS backend

RUN apk add --no-cache git gcc make musl-dev
WORKDIR /app

COPY ./ /app
COPY Cargo.toml Cargo.lock ./

WORKDIR /app
RUN cargo fetch

COPY . .

RUN rustup target add x86_64-unknown-linux-musl

RUN go install github.com/swaggo/swag/cmd/swag@latest
RUN go mod download
RUN apt update && apt install -y musl-tools musl-dev pkg-config libssl-dev ca-certificates

RUN make build
ENV OPENSSL_DIR=/usr
ENV OPENSSL_INCLUDE_DIR=/usr/include
ENV OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig

RUN cargo build --release --target x86_64-unknown-linux-musl

FROM node:20 AS frontend

COPY ./web /app

WORKDIR /app

RUN npm install
RUN npm run build

FROM alpine:3.14
FROM alpine:latest

COPY --from=backend /app/build/cloudsdale /app/cloudsdale
COPY --from=frontend /app/dist /app/dist
RUN apk --no-cache add ca-certificates

WORKDIR /app

VOLUME /var/run/docker.sock
COPY --from=backend /app/target/x86_64-unknown-linux-musl/release/cloudsdale .
COPY --from=frontend /app/dist ./dist

EXPOSE 8888

CMD ["./cloudsdale"]
CMD ["./cloudsdale"]
37 changes: 0 additions & 37 deletions Makefile

This file was deleted.

14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# Cloudsdale

[![Go Report Card](https://goreportcard.com/badge/github.com/elabosak233/cloudsdale)](https://goreportcard.com/report/github.com/elabosak233/cloudsdale)

The **Cloudsdale** project is an _open-source, light-weight, Jeopardy-style's_ CTF platform.
The **Cloudsdale** project is an _open-source, high-performance, Jeopardy-style's_ CTF platform.

You can read more in the [Documentation](https://docs.ctf.e23.dev).

## Special Thanks
## Contributors

Thanks to everyone who has contributed to the project! Without you, Cloudsdale would not be what it is today.

![](https://contrib.rocks/image?repo=ElaBosak233/Cloudsdale)

The current version of Cloudsdale, while ensuring the originality of the code, largely draws inspiration from [GZ::CTF](https://github.com/GZTimeWalker/GZCTF) in its frontend design. Therefore, I express my highest respect to [GZTimeWalker](https://github.com/GZTimeWalker), the author of GZ::CTF. At the same time, I also thank GZTime for his suggestions on Cloudsdale.
## Stars

![](https://starchart.cc/ElaBosak233/Cloudsdale.svg)

## License

This project is licensed under the [GNU General Public License v3.0](https://github.com/ElaBosak233/Cloudsdale/blob/main/LICENSE).
1 change: 0 additions & 1 deletion SECURITY.md

This file was deleted.

Loading

0 comments on commit 714f50c

Please sign in to comment.