From 8577609072b6ce04a26459e849738e1a0166ccf0 Mon Sep 17 00:00:00 2001 From: Kinan Lakhdar <83500470+KinanLak@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:17:08 +0200 Subject: [PATCH] CI ready --- .github/workflows/build.yml | 27 +++++++++++++++++++++++++++ Dockerfile | 15 +++++++++++++++ package.json | 4 +--- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7173dc2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,27 @@ +name: Build and push Docker image +on: + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3.6.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.9.1 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: kinanlak/spotipack:latest + platforms: linux/arm64 + cache-from: type=registry,ref=kinanlak/spotipack:buildcache + cache-to: type=registry,ref=kinanlak/spotipack:buildcache,mode=max \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ad2eb5d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:lts-alpine + +WORKDIR /app + +COPY package*.json ./ +RUN npm ci + +COPY . . +RUN npm run build + +FROM nginx:alpine + +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 80 \ No newline at end of file diff --git a/package.json b/package.json index de55c6f..5379ade 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "webpack serve --open --config webpack.dev.js", - "build": "webpack --config webpack.prod.js", - "predeploy": "npm run build", - "deploy": "gh-pages -d dist" + "build": "webpack --config webpack.prod.js" }, "repository": { "type": "git",