Feat: Containerised docker images (#700)
* chore: first pass at config file
* ci: pass app version
* ci: remove workflows that take a while to run to not waste build mins
* ci: run all steps all the time
* ci: correct tags
* ci: correct output syntax
* ci: use quotes
* ci: fix build platform
* ci: only build amd as PoC
* ci: add push true to step
* ci: publish trading and token containers
* fix: use correct environement variable names
* feat: separate dockerfiles for CRA based apps and next apps
* chore: correct path
* fix: incorrect asset path
* ci: build for both platforms
* ci: publish
* ci: add missing deps
* ci: rename pipelines
* ci: rename
* ci: publish on tag only
* ci: remove additional vs
* Revert "ci: remove workflows that take a while to run to not waste build mins"
This reverts commit 7054367ba0
.
* chore: remove comment
* chore: revert accientally committed change
This commit is contained in:
parent
e47298761a
commit
05d8cb3605
60
.github/workflows/publish-containers-cra.yml
vendored
Normal file
60
.github/workflows/publish-containers-cra.yml
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
name: Publish NextJs containers
|
||||
|
||||
'on':
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+-pre[0-9]+'
|
||||
|
||||
jobs:
|
||||
master:
|
||||
strategy:
|
||||
matrix:
|
||||
build-platform: ['linux/amd64']
|
||||
app: ['trading']
|
||||
name: Build the ${{ inputs.image_name }} image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set output
|
||||
id: vars
|
||||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
|
||||
- name: Check output
|
||||
env:
|
||||
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
|
||||
run: |
|
||||
echo $RELEASE_VERSION
|
||||
echo ${{ steps.vars.outputs.tag }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
id: quemu
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Collect images data
|
||||
id: tags
|
||||
run: |
|
||||
echo '::set-output name=current::vegaprotocol/${{ matrix.app }}:${{ steps.vars.outputs.tag }}'
|
||||
echo '::set-output name=latest::vegaprotocol/${{ matrix.app }}:latest'
|
||||
|
||||
- name: Echo tags
|
||||
run: |
|
||||
echo ${{ steps.tags.outputs.latest }}
|
||||
echo ${{ steps.tags.outputs.current }}
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Docker build
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: '.'
|
||||
file: './Dockerfile.next'
|
||||
build-args: 'APP=${{ matrix.app }}'
|
||||
platforms: ${{ matrix.build-platform }}
|
||||
tags: ${{ steps.tags.outputs.latest }},${{ steps.tags.outputs.current }}
|
||||
push: true
|
60
.github/workflows/publish-containers-next.yml
vendored
Normal file
60
.github/workflows/publish-containers-next.yml
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
name: Publish CRA containers
|
||||
|
||||
'on':
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+-pre[0-9]+'
|
||||
|
||||
jobs:
|
||||
master:
|
||||
strategy:
|
||||
matrix:
|
||||
build-platform: ['linux/amd64']
|
||||
app: ['explorer', 'token']
|
||||
name: Build the ${{ inputs.image_name }} image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set output
|
||||
id: vars
|
||||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
|
||||
- name: Check output
|
||||
env:
|
||||
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
|
||||
run: |
|
||||
echo $RELEASE_VERSION
|
||||
echo ${{ steps.vars.outputs.tag }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
id: quemu
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Collect images data
|
||||
id: tags
|
||||
run: |
|
||||
echo '::set-output name=current::vegaprotocol/${{ matrix.app }}:${{ steps.vars.outputs.tag }}'
|
||||
echo '::set-output name=latest::vegaprotocol/${{ matrix.app }}:latest'
|
||||
|
||||
- name: Echo tags
|
||||
run: |
|
||||
echo ${{ steps.tags.outputs.latest }}
|
||||
echo ${{ steps.tags.outputs.current }}
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Docker build
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: '.'
|
||||
file: './Dockerfile.cra'
|
||||
build-args: 'APP=${{ matrix.app }}'
|
||||
platforms: ${{ matrix.build-platform }}
|
||||
tags: ${{ steps.tags.outputs.latest }},${{ steps.tags.outputs.current }}
|
||||
push: true
|
@ -7,6 +7,7 @@ ENV PATH /app/node_modules/.bin:$PATH
|
||||
COPY package.json ./
|
||||
COPY yarn.lock ./
|
||||
COPY . ./
|
||||
RUN apk add python3 make gcc g++
|
||||
RUN yarn
|
||||
RUN yarn nx build $APP
|
||||
|
30
Dockerfile.next
Normal file
30
Dockerfile.next
Normal file
@ -0,0 +1,30 @@
|
||||
# Build container
|
||||
FROM node:16.14.0-alpine as build
|
||||
WORKDIR /app
|
||||
# Argument to allow building of different apps
|
||||
ARG APP
|
||||
ENV PATH /app/node_modules/.bin:$PATH
|
||||
COPY package.json ./
|
||||
COPY yarn.lock ./
|
||||
COPY . ./
|
||||
RUN apk add python3 make gcc g++
|
||||
RUN yarn
|
||||
RUN yarn nx export $APP
|
||||
|
||||
# Production environment
|
||||
FROM nginx:stable-alpine
|
||||
ARG APP
|
||||
COPY --from=build /app/dist/apps/$APP/exported /usr/share/nginx/html
|
||||
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
WORKDIR /usr/share/nginx/html
|
||||
COPY ./env.sh .
|
||||
COPY ./apps/$APP/.env .env
|
||||
|
||||
# Add bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
RUN chmod +x ./env.sh
|
||||
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]
|
@ -93,7 +93,7 @@ function VegaTradingApp(props: AppProps) {
|
||||
<link rel="stylesheet" href="https://static.vega.xyz/fonts.css" />
|
||||
{['1', 'true'].includes(process.env['NX_USE_ENV_OVERRIDES'] || '') ? (
|
||||
/* eslint-disable-next-line @next/next/no-sync-scripts */
|
||||
<script src="./env-config.js" type="text/javascript" />
|
||||
<script src="/assets/env-config.js" type="text/javascript" />
|
||||
) : null}
|
||||
</Head>
|
||||
<AppBody {...props} />
|
||||
|
@ -1,18 +1 @@
|
||||
window._env_ = {
|
||||
NX_CHAIN_EXPLORER_URL:
|
||||
'https://explorer.vega.trading/.netlify/functions/chain-explorer-api;',
|
||||
NX_TENDERMINT_URL: 'http://localhost:26617;',
|
||||
NX_TENDERMINT_WEBSOCKET_URL: 'wss://localhost:26617/websocket;',
|
||||
NX_VEGA_URL: 'http://localhost:3028/query;',
|
||||
NX_VEGA_ENV: 'LOCAL;',
|
||||
NX_VEGA_REST: 'http://localhost:3029;',
|
||||
NX_VEGA_REST: 'http://localhost:3029;',
|
||||
NX_VEGA_REST: 'http://localhost:3029;',
|
||||
NX_EXPLORER_ASSETS: '1;',
|
||||
NX_EXPLORER_GENESIS: '1;',
|
||||
NX_EXPLORER_GOVERNANCE: '1;',
|
||||
NX_EXPLORER_MARKETS: '1;',
|
||||
NX_EXPLORER_NETWORK_PARAMETERS: '1;',
|
||||
NX_EXPLORER_PARTIES: '1;',
|
||||
NX_EXPLORER_VALIDATORS: '1;',
|
||||
};
|
||||
window._env_ = {};
|
||||
|
@ -80,7 +80,9 @@ const getValue = (key: EnvKey, definitions: Partial<RawEnvironment> = {}) => {
|
||||
}
|
||||
return transformValue(
|
||||
key,
|
||||
definitions[key] ?? window._env_?.[key] ?? getBundledEnvironmentValue(key)
|
||||
definitions[key] ??
|
||||
window._env_?.[`NX_${key}`] ??
|
||||
getBundledEnvironmentValue(key)
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user