diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..ae4251d --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,45 @@ +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@v4 + 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: nelonoel/branch-name@v1.0.1 + + - name: Set outputs + id: vars + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - uses: mr-smithers-excellent/docker-build-push@v6.4 + name: push-container-image + with: + image: gepardec-gamertrack-frontend + registry: ghcr.io + multiPlatform: true + platform: linux/amd64,linux/arm64 + 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"]