Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup GitHub actions #7

Merged
merged 7 commits into from
Nov 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
.*
!.env
!.postcssrc.yml
README.md
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on: [push]

jobs:
build_image:
name: Build Docker image
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1
- name: Build Docker image
run: docker image build -t hawk-yard .

- name: Push to Docker hub if stage
if: github.ref == 'refs/heads/stage'
run: |
echo ${{secrets.DOCKER_PASSWORD}} | docker login --username ${{secrets.DOCKER_USERNAME}} --password-stdin ${{secrets.REGISTRY_ADDRESS}}
docker tag hawk-yard ${{secrets.REGISTRY_NAME}}/hawk-yard:stage
docker push ${{secrets.REGISTRY_NAME}}/hawk-yard:stage
- name: Deploy stage
if: github.ref == 'refs/heads/stage'
run: |
curl -X POST -H "Content-Type: application/json" --data "{\"branch\":\"master\",\"secret_token\":\"${{secrets.HAWK_STAGE_DEPLOY_TOKEN}}\"}" https://stage.hawk.so/deploy
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# build node-gyp modules in different stage
FROM node:10-alpine as build-stage

COPY . .

RUN yarn
RUN yarn build

# production environment
FROM nginx:1.17.3-alpine
COPY --from=build-stage /dist /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
15 changes: 15 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {
listen 80;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}
}