WIP: adding docker
This commit is contained in:
parent
ecb8eed175
commit
f8d48aedc9
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.cuddle/
|
11
cuddle.yaml
Normal file
11
cuddle.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# yaml-language-server: $schema=https://git.front.kjuulh.io/kjuulh/cuddle/raw/branch/main/schemas/base.json
|
||||||
|
|
||||||
|
base: "git@git.front.kjuulh.io:kjuulh/cuddle-base.git"
|
||||||
|
vars:
|
||||||
|
registry: "kasperhermansen"
|
||||||
|
|
||||||
|
scripts:
|
||||||
|
build_release:
|
||||||
|
type: shell
|
||||||
|
run_release:
|
||||||
|
type: shell
|
16
scripts/build_release.sh
Executable file
16
scripts/build_release.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "building docker image"
|
||||||
|
|
||||||
|
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
|
||||||
|
|
||||||
|
if [[ -n $DEBUG ]]
|
||||||
|
then
|
||||||
|
echo "debug:"
|
||||||
|
echo " REGISTRY: $REGISTRY"
|
||||||
|
echo " SERVICE: $SERVICE"
|
||||||
|
echo " COMMIT_SHA: $COMMIT_SHA"
|
||||||
|
echo " TMP: $TMP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build -t "$tag" -f "$TMP/build_release.Dockerfile" .
|
20
scripts/run_release.sh
Executable file
20
scripts/run_release.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "prebuiliding docker image"
|
||||||
|
|
||||||
|
cuddle_cli x build_release
|
||||||
|
|
||||||
|
echo "running docker image"
|
||||||
|
|
||||||
|
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
|
||||||
|
|
||||||
|
container_id=$(docker run -d "$tag")
|
||||||
|
|
||||||
|
sleep 5s
|
||||||
|
|
||||||
|
docker logs "$container_id"
|
||||||
|
|
||||||
|
echo "removing image"
|
||||||
|
docker stop "$container_id" > /dev/null && docker rm "$container_id" > /dev/null
|
13
templates/build_release.Dockerfile
Normal file
13
templates/build_release.Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM node:16.6-alpine as base
|
||||||
|
RUN pnpm i --global vite
|
||||||
|
|
||||||
|
FROM node:16.6-alpine as builder
|
||||||
|
|
||||||
|
WORKDIR /app/
|
||||||
|
|
||||||
|
COPY package.json .
|
||||||
|
COPY pnpm-lock.yaml .
|
||||||
|
|
||||||
|
RUN cargo build
|
||||||
|
|
||||||
|
CMD [ "cargo", "run" ]
|
Loading…
Reference in New Issue
Block a user