diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..79251e9 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,34 @@ +name: ci + +on: + push: + branches: + - master + pull_request: + +jobs: + web: + if: ${{ github.event_name == 'push' }} + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Login to DockerHub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + id: docker_build + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64 + context: . + file: ./Dockerfile + push: true + tags: | + sthlmio/web:1.0.${{ github.run_number }} + sthlmio/web:${{ github.sha }} + sthlmio/web:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9850167..e6d0e93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18.13-alpine AS builder +FROM node:20.12-alpine AS builder USER node @@ -16,7 +16,7 @@ COPY --chown=node:node . /home/node/web RUN npm run export -FROM nginx:1.23-alpine +FROM nginx:1.24-alpine COPY --from=builder /home/node/web/out /var/www COPY nginx.conf /etc/nginx/nginx.conf