1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

Docker cross-compilation with buildx (#2003)

* Build docker test

* Change platform to build on amd64

* Put back buildplatform

* Run frontend as separate docker task

* Increase timeout

* Update docs
This commit is contained in:
sjaanus 2022-08-30 12:39:28 +00:00 committed by GitHub
parent 8ef7789769
commit c4da10b15f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 6 deletions

View File

@ -11,3 +11,4 @@
!README.md
!frontend
frontend/node_modules
frontend/build

View File

@ -112,9 +112,9 @@ You'll need:
- username: `admin`
- password: `unleash4all`
### How to run Unleash with Docker
### How to run Unleash with Docker and Buildx
1. Build a local docker image by running `docker build . -t unleash:local`
1. Build a local docker image by running `docker buildx build . -t unleash:local`
2. Create a network by running `docker network create unleash`
3. Start a Postgres database. Make sure to use the network you created in step 2.

View File

@ -1,7 +1,14 @@
ARG NODE_VERSION=16-alpine
FROM node:$NODE_VERSION as builder
RUN echo "Debug - node version: $NODE_VERSION "
FROM --platform=$BUILDPLATFORM node:$NODE_VERSION as frontend_builder
WORKDIR /frontend
COPY ./frontend /frontend
RUN yarn install --frozen-lockfile
FROM node:$NODE_VERSION as builder
WORKDIR /unleash
@ -9,7 +16,9 @@ COPY . /unleash
RUN yarn config set network-timeout 300000
RUN yarn install --frozen-lockfile && yarn run local:package
RUN yarn install --frozen-lockfile --ignore-scripts && yarn run build && yarn run local:package
COPY --from=frontend_builder /frontend/build /unleash/build/frontend/build
WORKDIR /unleash/docker

View File

@ -33,7 +33,7 @@
"copy-templates": "copyfiles -u 1 src/mailtemplates/**/*.mustache dist/",
"db-migrate": "db-migrate --migrations-dir ./src/migrations",
"lint": "eslint ./src",
"local:package": "del-cli --force build && mkdir build && cp -r dist docs CHANGELOG.md LICENSE README.md package.json build && mkdir -p build/frontend && cp -r frontend/build build/frontend",
"local:package": "del-cli --force build && mkdir build && cp -r dist docs CHANGELOG.md LICENSE README.md package.json build",
"prebuild:watch": "yarn run clean",
"build:watch": "tsc -w",
"prebuild": "yarn run clean",