Skip to content

Commit 92d0d3c

Browse files
authored
Merge pull request #116 from Lemoncode/feature/add-deploy-pipelines
Add deploy workflow
2 parents 11571bc + f47d358 commit 92d0d3c

3 files changed

Lines changed: 60 additions & 0 deletions

File tree

‎.dockerignore‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vscode
2+
dist
3+
node_modules
4+
.editorconfig
5+
.env
6+
.env.example
7+
.gitignore
8+
package-lock.json
9+
README.md

‎.github/workflows/cd.yml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Continuos Deployment workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
env:
9+
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
10+
11+
jobs:
12+
cd:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
- name: Install heroku and login
18+
# Login using HEROKU_API_KEY env variable
19+
run: |
20+
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
21+
heroku container:login
22+
- name: Build docker image
23+
run: docker build -t registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/web .
24+
- name: Deploy docker image
25+
run: docker push registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/web
26+
- name: Release
27+
run: heroku container:release web -a ${{ secrets.HEROKU_APP_NAME }}

‎Dockerfile‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM node:12-alpine AS base
2+
RUN mkdir -p /usr/app
3+
WORKDIR /usr/app
4+
5+
# Build front
6+
FROM base AS build-frontend
7+
COPY ./front ./
8+
RUN npm install
9+
RUN npm run build
10+
11+
# Build backend
12+
FROM base AS build-backend
13+
COPY ./back ./
14+
RUN npm install
15+
RUN npm run build
16+
17+
# Release
18+
FROM base AS release
19+
COPY --from=build-backend /usr/app/dist ./
20+
COPY --from=build-frontend /usr/app/dist ./public
21+
COPY ./back/package.json ./
22+
RUN npm install --only=production
23+
24+
ENTRYPOINT [ "node", "index" ]

0 commit comments

Comments
 (0)