fix: DigitalOcean template (#4287)

## About the changes
Instead of building from source (we require Node 18 but [DigitalOcean
buildpack currently does not support
it](https://www.digitalocean.com/community/questions/app-platform-node-build-pack-can-t-use-node-version-18)),
we're going to use our Docker image from DockerHub:
https://hub.docker.com/r/unleashorg/unleash-server

Additionally, I realized that our Dockerfile only works in our CI (or
performing a pre-build step which consists of building the frontend).
With this PR I've also made a change to build the frontend if needed.
That way our CI will continue to be optimal while anyone trying to build
it from source will be able to do it by just running `docker build .`

Closes #4261
pull/4285/head
Gastón Fournier 10 months ago committed by GitHub
parent d3708297cf
commit a53d50148b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      .do/deploy.template.yaml
  2. 4
      Dockerfile
  3. 1
      package.json

@ -2,11 +2,11 @@ spec:
name: unleash
services:
- name: unleash-server
git:
branch: main
repo_clone_url: https://github.com/Unleash/unleash.git
build_command: 'yarn build'
run_command: 'yarn start'
image:
registry_type: DOCKER_HUB
registry: unleashorg
repository: unleash-server
tag: latest
envs:
- key: DATABASE_URL
scope: RUN_TIME

@ -10,7 +10,9 @@ RUN yarn config set network-timeout 300000
RUN yarn install --frozen-lockfile --ignore-scripts && yarn prepare:backend && yarn local:package
# frontend/build should already exist (it needs to be built in the local filesystem
# frontend/build should already exist (it needs to be built in the local filesystem but in case of a fresh build we'll build it here)
RUN yarn build:frontend:if-needed
RUN mkdir -p /unleash/build/frontend && mv /unleash/frontend/build /unleash/build/frontend/build
WORKDIR /unleash/docker

@ -34,6 +34,7 @@
"copy-templates": "copyfiles -u 1 src/mailtemplates/**/*.mustache dist/",
"build:backend": "tsc --pretty --strictNullChecks false",
"build:frontend": "yarn --cwd ./frontend run build",
"build:frontend:if-needed": "if [ ! -d ./frontend/build ]; then yarn install --cwd ./frontend --frozen-lockfile --ignore-scripts && yarn build:frontend; fi",
"build": "concurrently \"yarn:copy-templates\" \"yarn:build:frontend\" \"yarn:build:backend\"",
"dev:backend": "TZ=UTC NODE_ENV=development tsc-watch --strictNullChecks false --onSuccess \"node dist/server-dev.js\"",
"dev:frontend": "wait-on tcp:4242 && yarn --cwd ./frontend run dev",

Loading…
Cancel
Save