-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(docker): add docker for easily bootstrapping dev env
Changes: - Added docker for setting up dev frontend - Tweaked release/build system to remove building artifacts on release - Changed proxy settings to allow proxying to different backends - Added ability to set settings via .env file Signed-off-by: Danil Kostromin <[email protected]>
- Loading branch information
Danil Kostromin
committed
Jan 12, 2024
1 parent
5bd5778
commit fbacfef
Showing
9 changed files
with
131 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,29 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
branches: [main] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [20] | ||
steps: | ||
- name: Code Checkout | ||
uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'pnpm' | ||
- name: Install dependencies | ||
run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 pnpm install | ||
- name: Code Testing | ||
run: pnpm run test | ||
lint: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [20] | ||
steps: | ||
- name: Code Checkout | ||
uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'pnpm' | ||
- name: Install dependencies | ||
run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 pnpm install | ||
- name: Code Linting | ||
run: pnpm run lint | ||
name: CI | ||
on: | ||
pull_request: | ||
branches: [main] | ||
env: | ||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [20] | ||
steps: | ||
- name: Code Checkout | ||
uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'pnpm' | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Code Linting | ||
run: pnpm run lint | ||
- name: Code Testing | ||
run: pnpm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
# Username and password used to proxy requests to JSON logs | ||
BUBLIK_UI_DEV_LOGS_AUTH="<USERNAME>:<PASSWORD>" | ||
# This configuration is necessary for proper proxying of requests to django backend | ||
|
||
##################################################### | ||
# Example for connecting to ts-factory | ||
# BUBLIK_UI_DEV_LOGS_TARGET=https://ts-factory.io | ||
# BUBLIK_UI_DEV_BACKEND_TARGET=https://ts-factory.io | ||
# URL_PREFIX=/bublik/v2 | ||
|
||
##################################################### | ||
# This examples shows how to setup env for frontend served from `http://localhost/prefix/v2` | ||
# Target of JSON logs (protocol, host, port) | ||
BUBLIK_UI_DEV_LOGS_TARGET="https://example.com" | ||
BUBLIK_UI_DEV_LOGS_TARGET=http://localhost | ||
# Where backend is served (protocol, host, port) | ||
BUBLIK_UI_DEV_BACKEND_TARGET="http://localhost:8000" | ||
BUBLIK_UI_DEV_BACKEND_TARGET=http://localhost | ||
# Adds prefix from where backend is served e.g (http://localhost/prefix/api/v2) | ||
URL_PREFIX=/prefix/v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# Local | ||
.env.local | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
FROM node:17.9.0 | ||
FROM node:20-slim AS base | ||
|
||
ENV PNPM_HOME="/root/.local/share/pnpm" | ||
ENV PATH="${PATH}:${PNPM_HOME}" | ||
ARG PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 | ||
|
||
RUN npm install --global pnpm | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
|
||
RUN pnpm add -g nx | ||
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=${PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD} | ||
ENV BASE_URL="/v2" | ||
|
||
RUN corepack enable | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
COPY package.json pnpm-lock.yaml ./ | ||
RUN pnpm install | ||
FROM base as runner | ||
|
||
COPY . . | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install | ||
|
||
EXPOSE 4200 | ||
|
||
CMD ["pnpm", "run", "nx", "serve", "--host=0.0.0.0"] | ||
CMD ["pnpm", "run", "nx", "serve", "--host=0.0.0.0", "--base=${BASE_URL}"] |
Oops, something went wrong.