Add docker stuff
This commit is contained in:
parent
004088d3fb
commit
430e2ca814
6 changed files with 85 additions and 0 deletions
4
.dockerignore
Normal file
4
.dockerignore
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
.dockerignore
|
||||||
|
docker-bake.hcl
|
||||||
|
docker-compose.yml
|
||||||
|
Dockerfile
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,3 +3,5 @@
|
||||||
|
|
||||||
/target
|
/target
|
||||||
/out
|
/out
|
||||||
|
|
||||||
|
/docker-data
|
||||||
|
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
FROM rust:1 as builder
|
||||||
|
|
||||||
|
RUN rustup target add x86_64-unknown-linux-musl && \
|
||||||
|
apt update && \
|
||||||
|
apt install -y musl-tools musl-dev && \
|
||||||
|
update-ca-certificates
|
||||||
|
|
||||||
|
COPY ./ /emgauwa
|
||||||
|
|
||||||
|
FROM builder as builder-core
|
||||||
|
WORKDIR /emgauwa/core
|
||||||
|
RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||||
|
|
||||||
|
FROM builder as builder-controller
|
||||||
|
WORKDIR /emgauwa/controller
|
||||||
|
RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
COPY --from=builder-core /emgauwa/core/target/x86_64-unknown-linux-musl/release/emgauwa-core /usr/bin/emgauwa-core
|
||||||
|
COPY --from=builder-controller /emgauwa/controller/target/x86_64-unknown-linux-musl/release/emgauwa-controller /usr/bin/emgauwa-controller
|
||||||
|
|
||||||
|
CMD ["echo", "please specify command /usr/bin/emgauwa-core or /usr/bin/emgauwa-controller"]
|
13
Makefile
13
Makefile
|
@ -7,3 +7,16 @@ git-status:
|
||||||
|
|
||||||
git-diff:
|
git-diff:
|
||||||
git diff --submodule=diff
|
git diff --submodule=diff
|
||||||
|
|
||||||
|
cargo-all:
|
||||||
|
cd common && cargo $(ACTION)
|
||||||
|
cd controller && cargo $(ACTION)
|
||||||
|
cd core && cargo $(ACTION)
|
||||||
|
cargo-build:
|
||||||
|
$(MAKE) ACTION=build cargo-all
|
||||||
|
cargo-update:
|
||||||
|
$(MAKE) ACTION=update cargo-all
|
||||||
|
|
||||||
|
docker-bake:
|
||||||
|
cd controller && docker builder bake
|
||||||
|
cd core && docker builder bake
|
||||||
|
|
15
docker-bake.hcl
Normal file
15
docker-bake.hcl
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
variable "REG" {
|
||||||
|
default = "registry.serguzim.me"
|
||||||
|
}
|
||||||
|
variable "REPO" {
|
||||||
|
default = "emgauwa/combi"
|
||||||
|
}
|
||||||
|
variable "TAG" {
|
||||||
|
default = "latest"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "default" {
|
||||||
|
output = ["type=docker"]
|
||||||
|
dockerfile = "./Dockerfile"
|
||||||
|
tags = ["${REG}/${REPO}:latest", "${REG}/${REPO}:${TAG}"]
|
||||||
|
}
|
29
docker-compose.yml
Normal file
29
docker-compose.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
services:
|
||||||
|
core:
|
||||||
|
image: registry.serguzim.me/emgauwa/combi
|
||||||
|
command: /usr/bin/emgauwa-core
|
||||||
|
ports:
|
||||||
|
- "4419:4419"
|
||||||
|
environment:
|
||||||
|
EMGAUWA_CORE__SERVER__HOST: 0.0.0.0
|
||||||
|
EMGAUWA_CORE__DATABASE: sqlite:///data/core.sqlite
|
||||||
|
volumes:
|
||||||
|
- ./docker-data:/data
|
||||||
|
controller1:
|
||||||
|
image: registry.serguzim.me/emgauwa/combi
|
||||||
|
command: /usr/bin/emgauwa-controller
|
||||||
|
environment:
|
||||||
|
EMGAUWA_CONTROLLER__SERVER__HOST: core
|
||||||
|
EMGAUWA_CONTROLLER__DATABASE: sqlite:///data/controller1.sqlite
|
||||||
|
volumes:
|
||||||
|
- ./controller/emgauwa-controller.json:/etc/emgauwa/controller.json
|
||||||
|
- ./docker-data:/data
|
||||||
|
controller2:
|
||||||
|
image: registry.serguzim.me/emgauwa/combi
|
||||||
|
command: /usr/bin/emgauwa-controller
|
||||||
|
environment:
|
||||||
|
EMGAUWA_CONTROLLER__SERVER__HOST: core
|
||||||
|
EMGAUWA_CONTROLLER__DATABASE: sqlite:///data/controller2.sqlite
|
||||||
|
volumes:
|
||||||
|
- ./controller/emgauwa-controller.json:/etc/emgauwa/controller.json
|
||||||
|
- ./docker-data:/data
|
Loading…
Reference in a new issue