Sinetheta / blueprintnotincluded

Container for 3 components of blueprintnotincluded.org
https://blueprintnotincluded.org
MIT License
14 stars 4 forks source link

Containerize deploy #29

Closed Sinetheta closed 1 year ago

Sinetheta commented 1 year ago

This adds a deploy.Dockerfile which is designed to build a production ready version of the website. It is used by a new github action to auto deploy a [https://cloud.digitalocean.com/apps/edeb5658-aee8-4326-a4cf-6ff6858005fb/deployments?i=023d6b](staging app) to https://staging.blueprintnotincluded.org

local experimentation

docker build -t bni-deploy -f deploy.Dockerfile .
docker run --env-file=.env -e="DB_URI=mongodb://host.docker.internal:27017/blueprintnotincluded" -p 3000:3000 -p 27017:27017 bni-deploy

CAVEATS

in that script above you'll see that I --env-file=.env in order to give some ENV. In CI that is provided by the github runners or the digital ocean droplet. What I haven't fixed is the local build without docker. Right now it will be missing ENV if you follow the reasonable path of "build then serve". Until I can find a fix for both local and docker builds I suggest a workaround.

npm run build
cp .env build/.env
npm run serve:prod