diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..5dc27e0 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,37 @@ +name: Build Docker Image + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Copy Repo Files + uses: actions/checkout@master + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Portus + uses: docker/login-action@v1 + with: + registry: https://flotte-docker-registry.spdns.org/ + username: ${{ secrets.PORTUS_USERNAME }} + password: ${{ secrets.PORTUS_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm/v7,linux/arm64 + push: true + tags: | + flotte-docker-registry.spdns.org/frontend-server:latest diff --git a/Dockerfile b/Dockerfile index a33ada4..9ca613e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM node:14.14.0-alpine3.10 AS builder WORKDIR / COPY package.json package-lock.json ./ +RUN apk add --no-cache python3 RUN npm install && npm install -g @angular/cli && mkdir frontend RUN mv node_modules ./frontend WORKDIR /frontend @@ -12,7 +13,7 @@ FROM golang:1.13.4-alpine as builder2 ARG ARCH=amd64 RUN apk add git WORKDIR / -COPY --from=builder /frontend/dist /dist +COPY --from=builder /frontend/dist /dist RUN go get github.com/rakyll/statik RUN statik --src=/dist/flotte-frontend COPY *.go *.sum *.mod / diff --git a/README.md b/README.md index eadd3e0..e733c3e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FlotteFrontend -[![Build Status](https://travis-ci.com/fLotte-meets-HWR-DB/frontend.svg?token=YfRmpHAXqyUafCgSEexw&branch=master)](https://travis-ci.com/fLotte-meets-HWR-DB/frontend) +![Build Docker Image](https://github.com/fLotte-meets-HWR-DB/frontend/workflows/Build%20Docker%20Image/badge.svg) This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.8. @@ -59,4 +59,4 @@ We can't pass it in an other form, else it would not be possible to pass a value If the backend url changes, it has to be changed in the following files: - ./src/environments/ - ./apollo.config.js for autocompletion when writing queries etc. -- ./codegen.yml for graphQL codegen (to generate schema, types etc.) \ No newline at end of file +- ./codegen.yml for graphQL codegen (to generate schema, types etc.)