-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from grassrootseconomics/philip/0.1.0-apha
ci(deployment): Configure CI.
- Loading branch information
Showing
5 changed files
with
4,346 additions
and
5,110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
Oops, something went wrong.