Skip to content

Commit

Permalink
[INFRA] Use Github Actions (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinzou authored Mar 19, 2022
1 parent c8ff1ff commit 265806f
Show file tree
Hide file tree
Showing 10 changed files with 25,830 additions and 6,194 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gitignore
.dockerignore
Dockerfile
build
node_modules
README.md
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ORG_NAME = openemp-mf
ORG_NAME = openemp
PROJECT_NAME = drawer
HOST = localhost
PORT = 9003
33 changes: 33 additions & 0 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and push docker image
on: push
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16

- run: npm install
- run: npm test
- run: npm run build

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

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

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./
push: true
tags: openemp/drawer-ui:latest
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build and publish NPM package
on: push

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install
- run: npm test
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Test package
on: pull_request
jobs:
build-package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install
- run: npm test
- run: npm run build
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Name the node stage "builder"
FROM node:16-alpine AS builder

# Set working directory
WORKDIR /app

# Copy our node module specification
COPY package.json package.json
COPY package-lock.json package-lock.json

# install node modules and build assets
RUN npm install

# Copy all files from current directory to working dir in image
# Except the one defined in '.dockerignore'
COPY . .

# Create production build of React App
RUN npm run build

# Choose NGINX as our base Docker image
FROM nginx:alpine

# Set working directory to nginx asset directory
WORKDIR /usr/share/nginx/html

# Remove default nginx static assets
RUN rm -rf ./*

# Copy static assets from builder stage
COPY --from=builder /app/dist .

# Entry point when Docker container has started
ENTRYPOINT ["nginx", "-g", "daemon off;"]
Loading

0 comments on commit 265806f

Please sign in to comment.