Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Dmitry Belyaev | 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
|
|
@ -1,3 +1,3 @@
|
|||
[submodule "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 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 cargo fetch
|
||||
RUN cargo build --release
|
||||
|
||||
# install cargo-chef
|
||||
RUN cargo binstall -y cargo-chef
|
||||
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
|
||||
|
||||
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/release/qchgk_web /
|
||||
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/qchgk_web /
|
||||
|
||||
VOLUME /db
|
||||
|
||||
EXPOSE 8088/tcp
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
version: '2'
|
||||
services:
|
||||
qchgk:
|
||||
#build:
|
||||
# context: src
|
||||
# dockerfile: ../Dockerfile
|
||||
image: 'gitea.b4tman.ru/b4tman/qchgk:latest'
|
||||
build:
|
||||
context: src
|
||||
dockerfile: ../Dockerfile
|
||||
image: 'b4tman/qchgk:actix'
|
||||
container_name: 'qchgk'
|
||||
ports:
|
||||
- '8088:8088'
|
||||
|
@ -19,4 +19,4 @@ services:
|
|||
# RUST_BACKTRACE: 1
|
||||
# RUST_BACKTRACE: full
|
||||
volumes:
|
||||
- './db.dat:/db.dat:ro'
|
||||
- '/data/lab/docker/qchgk_web/db:/db/:ro'
|
||||
|
|
2
src
2
src
|
@ -1 +1 @@
|
|||
Subproject commit 5da53f79e45fad65a5acb0720b9fe6e3993dc806
|
||||
Subproject commit aec2e87472d777efbd6001089f54e62ec9d8cbcd
|
Loading…
Reference in New Issue