replace circleci with github workflows
This commit is contained in:
parent
147ff599f9
commit
226857edb5
|
@ -1,29 +0,0 @@
|
||||||
version: 2
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
docker:
|
|
||||||
- image: circleci/node:14.18.1-browsers
|
|
||||||
working_directory: ~/dwysokinski
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker:
|
|
||||||
version: 20.10.2
|
|
||||||
# start proprietary DB using private Docker image
|
|
||||||
# with credentials stored in the UI
|
|
||||||
- run: |
|
|
||||||
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
|
||||||
# build the application image
|
|
||||||
- run: docker build -t $DOCKER_LOGIN/dwysokinski.me:latest .
|
|
||||||
|
|
||||||
# deploy the image
|
|
||||||
- run: docker push $DOCKER_LOGIN/dwysokinski.me:latest
|
|
||||||
workflows:
|
|
||||||
version: 2
|
|
||||||
deploy_prod:
|
|
||||||
jobs:
|
|
||||||
- build:
|
|
||||||
context: dockerhub
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
name: Build and push to registry
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
push_to_registry:
|
||||||
|
name: Push Docker image to Docker Hub
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Get the version
|
||||||
|
id: get_version
|
||||||
|
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.REGISTRY_LOGIN }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Push to Docker Hub
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
tags: |
|
||||||
|
${{ secrets.REGISTRY_NAME }}/dwysokinski.me:latest
|
||||||
|
${{ secrets.REGISTRY_NAME }}/dwysokinski.me:${{ steps.get_version.outputs.VERSION }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
|
@ -18,7 +18,7 @@ RUN apk --no-cache add shadow \
|
||||||
pkgconf
|
pkgconf
|
||||||
RUN npm install --global gatsby-cli@3.3.0
|
RUN npm install --global gatsby-cli@3.3.0
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY package.json yarn.lock ./
|
COPY yarn.lock ./
|
||||||
RUN yarn
|
RUN yarn
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
Loading…
Reference in New Issue