diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c733f93 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/build +/config.json diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..f0362e0 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -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 diff --git a/.gitignore b/.gitignore index 9d01538..928d28c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .vscode build config.json -users.json \ No newline at end of file +users.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c14cd74 --- /dev/null +++ b/Dockerfile @@ -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"]