Init deploy.sh
This commit is contained in:
parent
0e4fb0408b
commit
d37bc1ae4d
4
.dockerignore
Normal file
4
.dockerignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
./_site
|
||||
./deploy.sh
|
||||
./Dockerfile
|
||||
./docker-compose.yml
|
|
@ -1,9 +1,8 @@
|
|||
{
|
||||
# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
|
||||
# no logging policy, don't log anything
|
||||
log {
|
||||
output file /var/log/caddy {
|
||||
roll_keep 16
|
||||
}
|
||||
output discard
|
||||
}
|
||||
}
|
||||
|
||||
|
|
12
Dockerfile
Normal file
12
Dockerfile
Normal file
|
@ -0,0 +1,12 @@
|
|||
FROM denoland/deno:alpine as build-stage
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app/
|
||||
RUN apk update && apk add bash
|
||||
RUN deno run -A https://deno.land/x/lume/install.ts
|
||||
RUN ./build.sh
|
||||
|
||||
FROM caddy:2.4.6-alpine
|
||||
|
||||
COPY --from=build-stage /app/_site /var/www/miom.space/
|
||||
COPY --from=build-stage /app/Caddyfile /etc/caddy/Caddyfile
|
1
build.sh
1
build.sh
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
rm -rf ./_site
|
||||
lume
|
||||
cp -r ./fonts ./_site/
|
||||
rm -rf ./_site/README
|
||||
|
|
41
deploy.sh
Executable file
41
deploy.sh
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# abort on first error
|
||||
set -e
|
||||
|
||||
TAG="$1"
|
||||
|
||||
if [[ -z "$TAG" ]]; then
|
||||
echo
|
||||
echo "Error: please provide a docker image tag as second argument, e.g.:"
|
||||
echo "./deploy.sh 1.0.0"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Workaround for SSL: CERTIFICATE_VERIFY_FAILED error with docker-compose
|
||||
if [ -z "$CURL_CA_BUNDLE" ]; then
|
||||
if [ ! -f ~/Downloads/cacert-2021-10-26.pem ]; then
|
||||
curl https://curl.se/ca/cacert-2021-10-26.pem -o ~/Downloads/cacert-2021-10-26.pem
|
||||
fi
|
||||
export CURL_CA_BUNDLE=~/Downloads/cacert-2021-10-26.pem
|
||||
fi
|
||||
|
||||
# make sure we're using the local docker host first
|
||||
eval "$(triton env --unset)"
|
||||
|
||||
# build the image locally
|
||||
docker build --tag hub.greenbaum.cloud/miom.space:"$TAG" .
|
||||
|
||||
# login to Greenbaum's private docker registry and push the image
|
||||
docker login hub.greenbaum.cloud
|
||||
docker push hub.greenbaum.cloud/miom.space:"$TAG"
|
||||
|
||||
# change DOCKER_HOST env var to remote docker host (Greenbaum's docker API)
|
||||
eval "$(triton --profile lev-1-pub.solar env)"
|
||||
|
||||
# use our tag for docker-compose
|
||||
export DEPLOY_TAG="$TAG"
|
||||
|
||||
# deploy on Greenbaum Cloud
|
||||
docker-compose up -d
|
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
version: "2.4"
|
||||
|
||||
services:
|
||||
miom-website:
|
||||
image: hub.greenbaum.cloud/miom.space:$DEPLOY_TAG
|
||||
mem_limit: 128m
|
||||
network_mode: My-Fabric-Network
|
||||
ports:
|
||||
- 80
|
||||
- 443
|
||||
labels:
|
||||
- triton.cns.services=miom-website
|
15
shell.nix
15
shell.nix
|
@ -1,10 +1,13 @@
|
|||
with (import (fetchTarball https://github.com/nixos/nixpkgs/archive/nixpkgs-unstable.tar.gz) {});
|
||||
mkShell {
|
||||
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/feed45d391471db2ecdbe5ba7aa301ab290a0c8f.tar.gz") {},
|
||||
nightingale-pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/f7949198dcff52265b322ca8abf7450610e7e49e.tar.gz") {}
|
||||
}:
|
||||
pkgs.mkShell {
|
||||
buildInputs = [
|
||||
nodejs
|
||||
deno
|
||||
nodePackages.json
|
||||
nodePackages.triton
|
||||
nightingale-pkgs.docker-compose
|
||||
pkgs.nodejs
|
||||
pkgs.deno
|
||||
pkgs.nodePackages.json
|
||||
pkgs.nodePackages.triton
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
|
|
Loading…
Reference in a new issue