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

chore: add the kafka and openapi dockerfile and create jobs for them #102

Merged
merged 15 commits into from
Feb 13, 2024
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
5 changes: 4 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
on:
push:
branch:
- main
- main

jobs:
check:
103 changes: 99 additions & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,110 @@
name: Build and Push Docker Image
name: Build and Push Docker Images

on:
push:
branches:
- dev
- docker_image
pull_request:
branches:
- dev

jobs:
build_and_push_docker_image:

openapi_image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build @paybox/openapi Docker image
run: docker build -t shawakash/paybox-openapi:${{ github.sha }} -f ./docker/openapi/Dockerfile .

- name: Generate the openapi client
run: docker run shawakash/paybox-openapi:${{ github.sha }} yarn gen

- name: Push @paybox/openapi Docker image
run: docker push shawakash/paybox-openapi:${{ github.sha }}

kafka_image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build @paybox/kafka Docker image
run: docker build -t shawakash/paybox-kafka:${{ github.sha }} -f ./docker/kafka/Dockerfile .

- name: Push @paybox/kafka Docker image
run: docker push shawakash/paybox-kafka:${{ github.sha }}

zeus_image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build @paybox/zeus Docker image
run: docker build -t shawakash/paybox-zeus:${{ github.sha }} -f ./docker/zeus/Dockerfile .

- name: Push @paybox/zeus Docker image
run: docker push shawakash/paybox-zeus:${{ github.sha }}

common_image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build @paybox/common Docker image
run: docker build -t shawakash/paybox-common:${{ github.sha }} -f ./docker/common/Dockerfile .

- name: Push @paybox/common Docker image
run: docker push shawakash/paybox-common:${{ github.sha }}

recoil_image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build @paybox/recoil Docker image
run: docker build -t shawakash/paybox-recoil:${{ github.sha }} -f ./docker/recoil/Dockerfile .

- name: Push @paybox/recoil Docker image
run: docker push shawakash/paybox-recoil:${{ github.sha }}

api_image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -22,7 +117,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build @paybox/api Docker image
run: docker build -t shawakash/paybox-api:latest -f ./docker/api/Dockerfile .
run: docker build -t shawakash/paybox-api:${{ github.sha }} -f ./docker/api/Dockerfile .

- name: Push @paybox/api Docker image
run: docker push shawakash/paybox-api:latest
run: docker push shawakash/paybox-api:${{ github.sha }}
7 changes: 4 additions & 3 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# https://github.com/actions/labeler

name: Labeler
on: [pull_request_target]
on:
- pull_request_target

jobs:
label:
Expand All @@ -17,6 +18,6 @@ jobs:
pull-requests: write

steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v5.0.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion backend/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"types": "./src/index.ts",
"type": "commonjs",
"license": "MIT",
"private": "false",
"private": "true",
"scripts": {
"build": "esbuild ./src/index.js --bundle --platform=node --outfile=dist/index.js",
"dev": "node dist/index.js --trace-warning"
Expand Down
2 changes: 1 addition & 1 deletion backend/zeus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"main": "./src/index.ts",
"types": "./src/index.ts",
"license": "MIT",
"private": "false",
"private": "true",
"scripts": {
"zeus": "zeus http://localhost:8112/v1/graphql ./src --header=x-hasura-admin-secret:myadminsecretkey --header=x-hasura-role:admin && prettier src/zeus/*.ts --write",
"build": "esbuild ./src/index.js --bundle --platform=node --outfile=dist/index.js",
Expand Down
9 changes: 5 additions & 4 deletions docker/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ FROM node:21
# Set the working directory in the container
WORKDIR /app/backend/api

# Copy package.json and yarn.lock to the working directory
COPY . .
# Copy the application code to the container
COPY . .

# Install app dependencies using Yarn
RUN yarn install

# Copy the application code to the container
# Build the pacakge
RUN yarn build

# Expose port 8080
EXPOSE 8080

# Command to run the application
CMD ["yarn", "start"]
CMD ["yarn", "dev"]
16 changes: 16 additions & 0 deletions docker/common/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Use the official Node.js image as the base image
FROM node:21

# Set the working directory in the container
WORKDIR /app/packages/common

# Copy package.json and yarn.lock to the working directory
COPY . .

# Install app dependencies using Yarn
RUN yarn install


# Build the pacakge
RUN yarn build

20 changes: 20 additions & 0 deletions docker/kafka/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use the official Node.js image as the base image
FROM node:21

# Set the working directory in the container
WORKDIR /app/packages/kafka

# Copy the application code to the container
COPY . .

# Install app dependencies using Yarn
RUN yarn install

# Build the pacakge
RUN yarn build

# Expose port 8080
EXPOSE 8081

# Command to run the application
CMD ["yarn", "dev"]
22 changes: 22 additions & 0 deletions docker/openapi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use the official Node.js image as the base image
FROM node:21

# Set the working directory in the container
WORKDIR /app/openapi/

# Copy package.json and yarn.lock to the working directory
COPY . .

# Install app dependencies using Yarn
RUN yarn install

# Copy the application code to the container

# Build the pacakge
RUN yarn build

# Command to run the application
CMD ["yarn", "dev"]

# Command to generate the OpenAPI client
CMD ["yarn", "gen"]
17 changes: 17 additions & 0 deletions docker/recoil/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Use the official Node.js image as the base image
FROM node:21

# Set the working directory in the container
WORKDIR /app/packages/recoil

# Copy package.json and yarn.lock to the working directory
COPY . .

# Install app dependencies using Yarn
RUN yarn install

# Copy the application code to the container

# Build the package
RUN yarn build

23 changes: 23 additions & 0 deletions docker/zeus/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use the official Node.js image as the base image
FROM node:21

# Set the working directory in the container
WORKDIR /app/openapi/

# Copy package.json and yarn.lock to the working directory
COPY . .

# Install app dependencies using Yarn
RUN yarn install

# Copy the application code to the container

# Create the client
RUN yarn zeus

# Genaerate the client
RUN yarn codegen

# Build the package
RUN yarn build

4 changes: 2 additions & 2 deletions openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"types": "./src/index.ts",
"type": "commonjs",
"license": "MIT",
"private": "false",
"private": "true",
"scripts": {
"build": "esbuild ./src/index.js --bundle --platform=node --outfile=dist/index.js & cp ./src/swagger/swagger.yaml ./dist/swagger.yaml",
"build": "esbuild ./src/index.js --bundle --platform=node --outfile=dist/index.js && cp ./src/swagger/swagger.yaml ./dist/swagger.yaml",
"dev": "node dist/index.js --trace-warning",
"gen": "openapi-generator generate -i src/swagger/swagger.yaml -g typescript-axios -o ./src/spec-client"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.6",
"main": "./src/index.ts",
"types": "./src/index.ts",
"private": "false",
"private": "true",
"scripts": {
"build": "esbuild ./src/index.js --bundle --platform=node --outfile=dist/index.js"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kafka/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"main": "./src/index.ts",
"types": "./src/index.ts",
"license": "MIT",
"private": "false",
"private": "true",
"scripts": {
"dev": "node dist/index.js --trace-warning",
"build": "esbuild ./src/index.js --bundle --platform=node --outfile=dist/index.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/recoil/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.6",
"main": "./src/index.ts",
"types": "./src/index.ts",
"private": "false",
"private": "true",
"scripts": {
"build": "esbuild ./src/index.js --bundle --platform=node --outfile=dist/index.js"
},
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7022,9 +7022,9 @@ json-schema-traverse@^0.4.1:
resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz"
integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==

json-schema@^0.4.0:
version "^0.4.0"
resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz"
json-schema@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.3.0.tgz#90a9c5054bd065422c00241851ce8d59475b701b"
integrity sha512-TYfxx36xfl52Rf1LU9HyWSLGPdYLL+SQ8/E/0yVyKG8wCCDaSrhPap0vEdlsZWRaS6tnKKLPGiEJGiREVC8kxQ==

json-stable-stringify-without-jsonify@^1.0.1:
Expand Down
Loading