WIP: adding docker

This commit is contained in:
Kasper Juul Hermansen 2022-08-11 22:22:45 +02:00
parent ecb8eed175
commit f8d48aedc9
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
5 changed files with 61 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.cuddle/

11
cuddle.yaml Normal file
View 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
View 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
View 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

View 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" ]