initial commit

This commit is contained in:
Dmitry Belyaev 2019-08-20 16:15:55 +03:00
commit 86d8fd16c8
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3
8 changed files with 156 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/db

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src"]
path = src
url = ssh://git@gitea.b4tman.ru:4222/b4tman/qchgk_web.git

27
Dockerfile Normal file
View File

@ -0,0 +1,27 @@
FROM ekidd/rust-musl-builder:1.36.0 as builder
COPY Cargo.toml /home/rust/src/
COPY Cargo.lock /home/rust/src/
RUN mkdir /home/rust/src/src && touch /home/rust/src/src/main.rs
RUN sudo chown -R rust:rust .
RUN cargo fetch
RUN cargo build --release || true
RUN rm -f /home/rust/src/src/main.rs
COPY src /home/rust/src/src
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
EXPOSE 8088/tcp
ENTRYPOINT ["/qchgk_web"]

39
alpine.Dockerfile Normal file
View File

@ -0,0 +1,39 @@
FROM ekidd/rust-musl-builder:1.36.0 as builder
COPY Cargo.toml /home/rust/src/
COPY Cargo.lock /home/rust/src/
RUN mkdir /home/rust/src/src && touch /home/rust/src/src/main.rs
RUN sudo chown -R rust:rust .
RUN cargo fetch
RUN cargo build --release || true
RUN rm -f /home/rust/src/src/main.rs
COPY src /home/rust/src/src
#COPY pre-main.rs /home/rust/src
#COPY add-Cargo.toml /home/rust/src\
#RUN mv /home/rust/src/src/main.rs /home/rust/src/tmp-main.rs &&\
# cat /home/rust/src/pre-main.rs > /home/rust/src/src/main.rs &&\
# cat /home/rust/src/tmp-main.rs >> /home/rust/src/src/main.rs &&\
# echo >> /home/rust/src/Cargo.toml &&\
# cat /home/rust/src/add-Cargo.toml >> /home/rust/src/Cargo.toml
#RUN sudo apt-get update && sudo apt-get install -y autogen automake git make
RUN cargo build --release
FROM alpine:3.10
RUN mkdir /app
COPY static /app/static
COPY templates /app/templates
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/qchgk_web /app/qchgk_web
RUN ls -lsha /app/qchgk_web
WORKDIR /app
EXPOSE 8088/tcp
CMD /app/qchgk_web

25
docker-compose.yml Normal file
View File

@ -0,0 +1,25 @@
version: '2'
services:
qchgk:
build:
context: src
dockerfile: ../stable.Dockerfile
# dockerfile: ../nightly.Dockerfile
image: 'b4tman/qchgk:actix'
# image: 'b4tman/qchgk:rocket'
container_name: 'qchgk'
ports:
- '8088:8088'
logging:
driver: json-file
options:
max-file: '5'
max-size: 10m
environment:
ROCKET_ENV: prod
ROCKET_PORT: 8088
# RUST_BACKTRACE: 1
# RUST_BACKTRACE: full
volumes:
- '/data/lab/docker/qchgk_web/db:/db/:ro'

30
nightly.Dockerfile Normal file
View File

@ -0,0 +1,30 @@
FROM ekidd/rust-musl-builder:nightly-2019-07-08 as builder
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 sudo chown -R rust:rust .
RUN cargo fetch
RUN cargo build --release
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
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
EXPOSE 8088/tcp
ENTRYPOINT ["/qchgk_web"]

1
src Submodule

@ -0,0 +1 @@
Subproject commit 665bbaadfb80c2b0fa7679ffea426107873e5894

30
stable.Dockerfile Normal file
View File

@ -0,0 +1,30 @@
FROM ekidd/rust-musl-builder:1.36.0 as builder
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 sudo chown -R rust:rust /home/rust/src/
RUN cargo fetch
RUN cargo build --release
RUN rm -f /home/rust/src/src/main.rs
COPY src /home/rust/src/src
RUN sudo chown -R rust:rust /home/rust/src/ && \
touch /home/rust/src/src/main.rs
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
EXPOSE 8088/tcp
ENTRYPOINT ["/qchgk_web"]