Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
d41f63f60b
|
@@ -1,6 +0,0 @@
|
|||||||
target
|
|
||||||
.git
|
|
||||||
.gitignore
|
|
||||||
.drone.yml
|
|
||||||
docker-compose.yml
|
|
||||||
.pre-commit-config.yaml
|
|
56
.drone.yml
56
.drone.yml
@@ -1,56 +0,0 @@
|
|||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: submodules
|
|
||||||
image: alpine/git
|
|
||||||
commands:
|
|
||||||
- git submodule update --init --recursive
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: gitea.b4tman.ru
|
|
||||||
username: b4tman
|
|
||||||
repo: gitea.b4tman.ru/b4tman/qchgk
|
|
||||||
tags: latest
|
|
||||||
context: src
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
dry_run: true
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: publish
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: submodules
|
|
||||||
image: alpine/git
|
|
||||||
commands:
|
|
||||||
- git submodule update --init --recursive
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: gitea.b4tman.ru
|
|
||||||
username: b4tman
|
|
||||||
repo: gitea.b4tman.ru/b4tman/qchgk
|
|
||||||
auto_tag: true
|
|
||||||
context: src
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
password:
|
|
||||||
from_secret: gitea_password
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
- rocket
|
|
||||||
- actix
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
|||||||
[submodule "src"]
|
[submodule "src"]
|
||||||
path = src
|
path = src
|
||||||
url = https://gitea.b4tman.ru/b4tman/qchgk_web.git
|
url = ssh://git@gitea.b4tman.ru:4222/b4tman/qchgk_web.git
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
# See https://pre-commit.com for more information
|
|
||||||
# See https://pre-commit.com/hooks.html for more hooks
|
|
||||||
repos:
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
||||||
rev: v3.2.0
|
|
||||||
hooks:
|
|
||||||
- id: trailing-whitespace
|
|
||||||
- id: end-of-file-fixer
|
|
||||||
- id: check-yaml
|
|
||||||
- id: check-added-large-files
|
|
40
Dockerfile
40
Dockerfile
@@ -1,39 +1,29 @@
|
|||||||
FROM rust:1-alpine as chef
|
FROM ekidd/rust-musl-builder:1.36.0 as builder
|
||||||
|
|
||||||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL sparse
|
COPY Cargo.toml /home/rust/src/
|
||||||
|
COPY Cargo.lock /home/rust/src/
|
||||||
|
RUN mkdir /home/rust/src/src && \
|
||||||
|
echo 'fn main() {}' > /home/rust/src/src/main.rs
|
||||||
|
|
||||||
RUN apk add --no-cache musl-dev curl
|
RUN sudo chown -R rust:rust .
|
||||||
|
|
||||||
# install cargo-binstall
|
RUN cargo fetch
|
||||||
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh -o install-from-binstall-release.sh
|
RUN cargo build --release
|
||||||
RUN sh install-from-binstall-release.sh
|
|
||||||
|
|
||||||
# install cargo-chef
|
RUN rm -f /home/rust/src/src/main.rs
|
||||||
RUN cargo binstall -y cargo-chef
|
COPY src /home/rust/src/src
|
||||||
|
RUN sudo chown -R rust:rust . && \
|
||||||
|
touch /home/rust/src/src/main.rs
|
||||||
|
|
||||||
WORKDIR /home/rust/src
|
|
||||||
|
|
||||||
FROM chef AS planner
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN cargo chef prepare --recipe-path recipe.json
|
|
||||||
|
|
||||||
FROM chef as builder
|
|
||||||
COPY --from=planner /home/rust/src/recipe.json recipe.json
|
|
||||||
|
|
||||||
# build & cache deps
|
|
||||||
RUN cargo chef cook --release --recipe-path recipe.json
|
|
||||||
|
|
||||||
# build app with cached deps
|
|
||||||
COPY . .
|
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
COPY static /static
|
COPY static /static
|
||||||
COPY templates /templates
|
COPY templates /templates
|
||||||
COPY --from=builder /home/rust/src/target/release/qchgk_web /
|
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/qchgk_web /
|
||||||
|
|
||||||
|
VOLUME /db
|
||||||
|
|
||||||
EXPOSE 8088/tcp
|
EXPOSE 8088/tcp
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
version: '2'
|
version: '2'
|
||||||
services:
|
services:
|
||||||
qchgk:
|
qchgk:
|
||||||
#build:
|
build:
|
||||||
# context: src
|
context: src
|
||||||
# dockerfile: ../Dockerfile
|
dockerfile: ../Dockerfile
|
||||||
image: 'gitea.b4tman.ru/b4tman/qchgk:latest'
|
image: 'b4tman/qchgk:actix'
|
||||||
container_name: 'qchgk'
|
container_name: 'qchgk'
|
||||||
ports:
|
ports:
|
||||||
- '8088:8088'
|
- '8088:8088'
|
||||||
@@ -19,4 +19,4 @@ services:
|
|||||||
# RUST_BACKTRACE: 1
|
# RUST_BACKTRACE: 1
|
||||||
# RUST_BACKTRACE: full
|
# RUST_BACKTRACE: full
|
||||||
volumes:
|
volumes:
|
||||||
- './db.dat:/db.dat:ro'
|
- '/data/lab/docker/qchgk_web/db:/db/:ro'
|
||||||
|
2
src
2
src
Submodule src updated: da962a9f7a...aec2e87472
Reference in New Issue
Block a user