Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/update dockerfiles #961

Merged
merged 3 commits into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/push-docker-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This workflow pushes osmosis docker images on every commit to master.
#
# The following images are pushed:
#
# - `osmolabs/osmosis-frontend:{COMMIT_SHORT_SHA}
# - `osmolabs/osmosis-frontend-frontier:{COMMIT_SHORT_SHA}
# - `osmolabs/osmosis-frontend-testnet:{COMMIT_SHORT_SHA}
#
# All the images above have support for linux/amd64 and linux/arm64.
#
# Due to QEMU virtualization used to build multi-platform docker images
# this workflow might take a while to complete.

name: Push Docker Images

on:
push:
branches:
- master

env:
FRONTEND_DOCKER_REPOSITORY: osmolabs/osmosis-frontend
FRONTIER_DOCKER_REPOSITORY: osmolabs/osmosis-frontend-frontier
TESTNET_DOCKER_REPOSITORY: osmolabs/osmosis-frontend-testnet

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Check out repo
uses: actions/checkout@v3
-
name: Get Short SHA
uses: benjlevesque/[email protected]
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push (main)
uses: docker/build-push-action@v3
with:
file: ./docker/Dockerfile
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ env.FRONTEND_DOCKER_REPOSITORY }}:${{ env.SHA }}, ${{ env.FRONTEND_DOCKER_REPOSITORY }}:latest
-
name: Build and push (frontier)
uses: docker/build-push-action@v3
with:
file: ./docker/Dockerfile.frontier
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ env.FRONTIER_DOCKER_REPOSITORY }}:${{ env.SHA }}, ${{ env.FRONTIER_DOCKER_REPOSITORY }}:latest
-
name: Build and push (testnet)
uses: docker/build-push-action@v3
with:
file: ./docker/Dockerfile.testnet
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ env.TESTNET_DOCKER_REPOSITORY }}:${{ env.SHA }}, ${{ env.TESTNET_DOCKER_REPOSITORY }}:latest
20 changes: 0 additions & 20 deletions Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions docker-compose.yml

This file was deleted.

17 changes: 17 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18 as build

WORKDIR /app

COPY lerna.json package.json tsconfig.json yarn.lock /app/
COPY packages /app/packages/

RUN yarn
RUN yarn build

FROM node:18-alpine3.15

WORKDIR /app
COPY --from=build /app .

EXPOSE 3000
CMD [ "yarn", "start" ]
17 changes: 17 additions & 0 deletions docker/Dockerfile.frontier
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18 as build

WORKDIR /app

COPY lerna.json package.json tsconfig.json yarn.lock /app/
COPY packages /app/packages/

RUN yarn
RUN yarn build:frontier

FROM node:18-alpine3.15

WORKDIR /app
COPY --from=build /app .

EXPOSE 3000
CMD [ "yarn", "start:frontier" ]
17 changes: 17 additions & 0 deletions docker/Dockerfile.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18 as build

WORKDIR /app

COPY lerna.json package.json tsconfig.json yarn.lock /app/
COPY packages /app/packages/

RUN yarn
RUN yarn build:testnet

FROM node:18-alpine3.15

WORKDIR /app
COPY --from=build /app .

EXPOSE 3000
CMD [ "yarn", "start:testnet" ]
11 changes: 11 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
frontend:
docker-compose up

frontier:
docker-compose -profile frontier up

testnet:
docker-compose -profile testnet up

all:
docker-compose -profile all up
57 changes: 57 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Docker

There are three different frontend flavours:

- Main
- Frontier
- Testnet

## Run main frontend

```bash
make frontend
```

Browse to [http://localhost:3000/](http://localhost:3000/)

## Run frontier

```bash
make frontier
```

Browse to [http://localhost:3001/](http://localhost:3001/)

## Run testnet

```bash
make testnet
```

Browse to [http://localhost:3002/](http://localhost:3002/)

## Run all

You can run them all with `make all`

## Build images

In case you need to build images only:

### Main

```bash
docker-compose build frontend -t osmosis-frontend:main
```

### Frontier

```bash
docker-compose build frontend-frontier -t osmosis-frontend:frontier
```

### Testnet

```bash
docker-compose build frontend-testnet -t osmosis-frontend:testnet
```
33 changes: 33 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.5'

services:

frontend:
build:
context: ../
dockerfile: ./Dockerfile
ports:
- '3000:3000'
profiles:
- default
- all

frontend-frontier:
build:
context: ../
dockerfile: ./Dockerfile.frontier
ports:
- '3001:3000'
profiles:
- frontier
- all

frontend-testnet:
build:
context: ../
dockerfile: ./Dockerfile.testnet
ports:
- '3002:3000'
profiles:
- testnet
- all
jonator marked this conversation as resolved.
Show resolved Hide resolved