Compare commits

..

2 Commits

10 changed files with 17 additions and 55 deletions

View File

@@ -20,5 +20,3 @@ scripts:
type: shell
push_release:
type: shell
deploy:
type: shell

3
renovate.json Normal file
View File

@@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}

View File

@@ -16,9 +16,7 @@ then
fi
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
#docker pull "$latest_tag"
docker pull "$latest_tag"
export DOCKER_BUILDKIT=1
docker build -t "$tag" -f "$TMP/build_release.Dockerfile" --build-arg "BIN_NAME=$BIN_NAME" --target=runtime .
DOCKER_BUILDKIT=1 docker build --cache-from "$latest_tag" -t "$tag" -f "$TMP/build_release.Dockerfile" .
docker tag "$tag" "$latest_tag"

View File

@@ -1,7 +0,0 @@
export $(cat .env | xargs)
cuddle x start_deployment
cuddle x render_templates
cuddle x build_release
cuddle x push_release
cuddle x deploy_release

View File

@@ -5,8 +5,6 @@ set -e
echo "deploying image"
deploymentrepo="$TMP/deployments"
cd "$deploymentrepo"
cd $deploymentrepo
[[ -z $(git status -s) ]] && (echo 'git repository is clean'; exit 0)
git add . && git commit --allow-empty -m "Added release $SERVICE: ${COMMIT_SHA:0:10}" && git pull && git push
git add . && git commit -m "Added release $SERVICE: ${COMMIT_SHA:0:10}" && git pull && git push

View File

@@ -12,5 +12,5 @@ echo "docker: logging in"
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
echo "docker: pushing image $tag"
docker push "$base_tag"
docker push --all-tags "$base_tag"

View File

@@ -5,7 +5,7 @@ set -e
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
deploymentrepo="$TMP/deployments"
CUDDLE_FETCH_POLICY=never cuddle render_template \
CUDDLE_FETCH_POLICY=never cuddle_cli render_template \
--template-file "$TMP/docker-compose.deploy_release.yml.tmpl" \
--dest "$deploymentrepo/$SERVICE/docker-compose.yml" \
--extra-var "image=$tag"

View File

@@ -4,7 +4,7 @@ set -e
echo "prebuiliding docker image"
cuddle x build_release
cuddle_cli x build_release
echo "running docker image"

View File

@@ -1,39 +1,11 @@
FROM rust:1.70 AS chef
# We only pay the installation cost once,
# it will be cached from the second build onwards
RUN <<EOF
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
EOF
FROM rust:1.62.1-slim-buster
ENV DOCKER_BUILD=true
ENV SQLX_OFFLINE true
RUN apt-get update && apt-get upgrade -y
RUN apt-get install libssl-dev
RUN apt-get install -y -q build-essential curl
RUN <<EOF
apt update -y && apt install -y libc6-dev libssl-dev libpq-dev
EOF
RUN cargo binstall --no-confirm --no-symlinks cargo-chef
WORKDIR app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
ARG BIN_NAME
COPY . .
RUN cargo build --release --bin $BIN_NAME
# We do not need the Rust toolchain to run the binary!
FROM debian:buster-slim as runtime
ARG BIN_NAME
WORKDIR app
COPY --from=builder /app/target/release/$BIN_NAME /usr/local/bin
CMD ["/usr/local/bin/$BIN_NAME"]
RUN cargo build
CMD [ "cargo", "run" ]

View File

@@ -10,7 +10,7 @@ services:
depends_on:
- db
db:
image: postgres:15.3
image: postgres:13.5
restart: always
env_file: ".env"
volumes: