Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
85bac6aca5
|
|||
3ffee54d1c
|
|||
a95457dd4e
|
|||
efe197238a
|
|||
4f26722592
|
|||
a23a36fa5b
|
|||
b9762fa150
|
|||
4c2c957472
|
|||
ebe8970ada
|
|||
a6783d673a
|
|||
e5c7761dc6
|
|||
989201bfc8
|
|||
55c1f5c6f0
|
|||
d01a63a7c0
|
|||
9d24c83c5c
|
|||
ce023126fc
|
|||
72682925a0
|
|||
66cf530a2b
|
|||
e7d4a18d3e
|
|||
891a4bced1
|
|||
0e45db7f60
|
|||
5e62c8982c
|
|||
1a5548b00e
|
|||
9483ad3564
|
|||
50cfbb6642
|
|||
438d254c11
|
|||
bfaeba816e
|
|||
f4af0d5e77
|
|||
7bd1c14a27
|
|||
8ecb2e073e
|
|||
83f2785481
|
|||
6553dbf3d1
|
|||
6ede87f0fd
|
|||
926e700828
|
|||
5b436e226a
|
|||
66cd8339c3
|
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
target
|
||||
.git
|
||||
.gitignore
|
||||
.drone.yml
|
||||
docker-compose.yml
|
||||
.pre-commit-config.yaml
|
56
.drone.yml
Normal file
56
.drone.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
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"]
|
||||
path = src
|
||||
url = ssh://git@gitea.b4tman.ru:4222/b4tman/qchgk_web.git
|
||||
url = https://gitea.b4tman.ru/b4tman/qchgk_web.git
|
||||
|
10
.pre-commit-config.yaml
Normal file
10
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
# 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,29 +1,39 @@
|
||||
FROM ekidd/rust-musl-builder:1.36.0 as builder
|
||||
FROM rust:1-alpine as chef
|
||||
|
||||
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
|
||||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL sparse
|
||||
|
||||
RUN sudo chown -R rust:rust .
|
||||
RUN apk add --no-cache musl-dev curl
|
||||
|
||||
RUN cargo fetch
|
||||
RUN cargo build --release
|
||||
# install cargo-binstall
|
||||
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 sh install-from-binstall-release.sh
|
||||
|
||||
RUN rm -f /home/rust/src/src/main.rs
|
||||
COPY src /home/rust/src/src
|
||||
RUN sudo chown -R rust:rust . && \
|
||||
touch /home/rust/src/src/main.rs
|
||||
# install cargo-chef
|
||||
RUN cargo binstall -y cargo-chef
|
||||
|
||||
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
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY static /static
|
||||
COPY templates /templates
|
||||
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/qchgk_web /
|
||||
|
||||
VOLUME /db
|
||||
COPY --from=builder /home/rust/src/target/release/qchgk_web /
|
||||
|
||||
EXPOSE 8088/tcp
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
version: '2'
|
||||
services:
|
||||
qchgk:
|
||||
build:
|
||||
context: src
|
||||
dockerfile: ../Dockerfile
|
||||
image: 'b4tman/qchgk:actix'
|
||||
#build:
|
||||
# context: src
|
||||
# dockerfile: ../Dockerfile
|
||||
image: 'gitea.b4tman.ru/b4tman/qchgk:latest'
|
||||
container_name: 'qchgk'
|
||||
ports:
|
||||
- '8088:8088'
|
||||
@@ -19,4 +19,4 @@ services:
|
||||
# RUST_BACKTRACE: 1
|
||||
# RUST_BACKTRACE: full
|
||||
volumes:
|
||||
- '/data/lab/docker/qchgk_web/db:/db/:ro'
|
||||
- './db.dat:/db.dat:ro'
|
||||
|
2
src
2
src
Submodule src updated: aec2e87472...5da53f79e4
Reference in New Issue
Block a user