improved dockerizing

pull/1/head
plazmoid 3 years ago
parent 700154e311
commit ee514ecb20
  1. 1
      .gitignore
  2. 2
      images/integration-tests/tests_runner.Dockerfile
  3. 10
      images/integration-tests/u_db.Dockerfile
  4. 5
      images/integration-tests/u_db_entrypoint.sh
  5. 4
      images/integration-tests/u_server.Dockerfile
  6. 20
      integration/docker-compose.yml

1
.gitignore vendored

@ -9,3 +9,4 @@ echoer
.env.private
*.lock
static/
.vscode/

@ -1,4 +1,4 @@
FROM rust:1.53
FROM rust:1.55
RUN rustup target add x86_64-unknown-linux-musl
CMD ["sleep", "3600"]

@ -1,3 +1,11 @@
FROM postgres:13.3
RUN apt update && apt -y upgrade && apt install -y iproute2
RUN apt update && apt upgrade -y
RUN apt install -y curl build-essential libpq-dev iproute2
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal
ENV PATH /root/.cargo/bin:$PATH
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo install diesel_cli --no-default-features --features postgres
RUN mkdir -p /unki
COPY u_db_entrypoint.sh /unki/

@ -0,0 +1,5 @@
set -m
export DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@127.0.0.1/${DB_NAME}
/usr/local/bin/docker-entrypoint.sh postgres &
sleep 10 && diesel setup && fg %1

@ -1,3 +1,3 @@
FROM rust:1.53
FROM alpine:latest
RUN cargo install diesel_cli --no-default-features --features postgres
RUN apk add iproute2 bash

@ -11,11 +11,9 @@ services:
- u_net
volumes:
- ../target/x86_64-unknown-linux-musl/release/u_server:/u_server
- ../:/unki/
- ../certs:/unki/certs
working_dir: /unki
command: bash -c "
export DATABASE_URL=postgres://$${DB_USER}:$${DB_PASSWORD}@$${DB_HOST}/$${DB_NAME} &&
diesel setup && diesel migration run && /u_server"
command: /u_server
depends_on:
u_db:
condition: service_healthy
@ -27,7 +25,7 @@ services:
environment:
RUST_LOG: trace
healthcheck:
test: /bin/ss -tlpn | grep 63714
test: ss -tlpn | grep 63714
interval: 5s
timeout: 2s
retries: 2
@ -41,11 +39,17 @@ services:
env_file:
- ../.env
- ../.env.private
working_dir: /unki
volumes:
- ../migrations:/unki/migrations
- ../Cargo.toml:/unki/Cargo.toml
command: /unki/u_db_entrypoint.sh
healthcheck:
test: /bin/ss -tlpn | grep 5432
# test if db's port is open and db is created
test: ss -tlpn | grep 5432 && psql -lqt -U $${DB_USER} | grep -qw $${DB_NAME}
interval: 5s
timeout: 2s
retries: 2
timeout: 5s
retries: 3
u_agent_1:
image: unki/u_agent

Loading…
Cancel
Save