Skip to content

Commit

Permalink
Merge pull request #29 from grassrootseconomics/philip/0.1.0-apha
Browse files Browse the repository at this point in the history
ci(deployment): Configure CI.
  • Loading branch information
mango-habanero authored Apr 30, 2023
2 parents 61d0258 + 6dcae31 commit bb7574a
Show file tree
Hide file tree
Showing 5 changed files with 4,346 additions and 5,110 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: release

on:
push:
branches:
- main
pull_request:
types: [closed]
branches:
- main

jobs:
docker:
runs-on: ubuntu-latest
steps:

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

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

- name: Check out repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set environment variables
run: |
echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV \
&& echo "RELEASE_SHORT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64
push: true
build-args: |
BUILD_COMMIT=${{ env.RELEASE_SHORT_COMMIT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: |
ghcr.io/${{ github.repository_owner }}/cic-ussd/cic-ussd:latest
ghcr.io/${{ github.repository_owner }}/cic-ussd/cic-ussd:${{ env.RELEASE_TAG }}
34 changes: 34 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"git": {
"commit": true,
"commitMessage": "chore(release): Release v${version}",
"requireCleanWorkingDir": false,
"tagName": "v${version}"
},
"github": {
"preRelease": true,
"release": true,
"releaseName": "Release v${version}",
"token": "${GITHUB_TOKEN}"
},
"npm": {
"publish": false
},
"options": {
"name": "cic-ussd",
"noAssets": true,
"preRelease": true,
"release": true,
"tagPrefix": "v"
},
"plugins": {
"@release-it/conventional-changelog": {
"header": "# Changelog",
"infile": "CHANGELOG.md",
"preset": "angular",
"releaseNotes": {
"outputUnreleased": true
}
}
}
}
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# base image
FROM node:18-alpine as build
FROM node:18-alpine3.15 as base
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install -g npm@latest
RUN npm ci --omit=optional

# build stage
FROM base as build
COPY . .
RUN npm run build
EXPOSE 9000
CMD ["npm", "start"]

# final stage
FROM base as final
COPY --from=build /usr/src/app/dist ./dist
EXPOSE $PORT
CMD ["npm", "start"]
Loading

0 comments on commit bb7574a

Please sign in to comment.