From 699eac5e4087bc65271f8dbfcc2c75248067dd5e Mon Sep 17 00:00:00 2001 From: Aleksandar Zivkovic Date: Wed, 22 Jan 2025 11:08:20 +0100 Subject: [PATCH] WIP add build and publish image workflow, add Dockerfile --- .github/workflows/build.yaml | 37 ++++++++++++++++++++++++++++++++++++ Dockerfile | 13 +++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..e4c0ec1 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,37 @@ +name: Build and publish image + +on: + push: + branches: + - main + - dev + workflow_dispatch: + + jobs: + build-test-push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + name: checkout + + - name: Cache node modules + uses: actions/cache@v1 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - uses: mr-smithers-excellent/docker-build-push@v5 + name: push-container-image + with: + image: gepardec-gamertrack-frontend + registry: ghcr.io + username: ${{ github.repository }} + password: ${{ secrets.GITHUB_TOKEN }} + # if the branch is main, add the latest tag + addLatest: ${{ github.ref == 'refs/heads/main' }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..56de9d5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:alpine + +WORKDIR /usr/src/app + +COPY . /usr/src/app + +RUN npm install -g @angular/cli + +RUN npm install + +EXPOSE 4200 + +CMD ["ng", "serve", "--host", "0.0.0.0"]