[WIP] ci: add Dockerfile and deploy workflow
This commit is contained in:
William Katz 2021-06-15 22:36:21 -07:00 committed by GitHub
commit 32b212b83b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 1 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
/build
/config.json

31
.github/workflows/deploy.yaml vendored Normal file
View file

@ -0,0 +1,31 @@
name: Publish Staging
on:
push:
branches:
- cicd
jobs:
release:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Login to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Format repository
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build container image
uses: docker/build-push-action@v2
with:
push: true
tags: |
docker.pkg.github.com/${{ env.IMAGE_REPOSITORY }}/ccash:${{ github.sha }}
docker.pkg.github.com/${{ env.IMAGE_REPOSITORY }}/ccash:latest

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
.vscode .vscode
build build
config.json config.json
users.json users.json

16
Dockerfile Normal file
View file

@ -0,0 +1,16 @@
FROM debian:latest
WORKDIR /ccash
RUN apt update && apt -y install build-essential g++ cmake protobuf-compiler libjsoncpp-dev uuid-dev openssl libssl-dev zlib1g-dev
COPY . .
RUN mkdir build
WORKDIR /ccash/build
RUN cmake ..
RUN make -j$(nprov)
CMD ["/ccash/build/bank", "$CCASH_ADMIN_PASSWORD", "$CCASH_SAVE_FREQUENCY", "$CCASH_THREAD_COUNT"]