Last active
August 21, 2021 23:41
-
-
Save GuillermoFarias/f2b221a164092cdeed5a1662830e8c22 to your computer and use it in GitHub Desktop.
CI / CD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# build stage | |
FROM node:lts-alpine as build | |
WORKDIR /app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . | |
ARG VERSION=1.0 | |
ENV VUE_APP_TAG_VERSION ${VERSION} | |
RUN npm run build | |
# production stage | |
FROM nginx:alpine | |
COPY --from=build /app/dist /usr/share/nginx/html | |
EXPOSE 80 | |
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="hello"> | |
<h1>{{ msg }} {{ version }}</h1> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: "HelloWorld", | |
data() { | |
return { | |
version: process.env.VUE_APP_TAG_VERSION, | |
}; | |
}, | |
props: { | |
msg: String, | |
}, | |
}; | |
</script> | |
<!-- Add "scoped" attribute to limit CSS to this component only --> | |
<style scoped> | |
h3 { | |
margin: 40px 0 0; | |
} | |
ul { | |
list-style-type: none; | |
padding: 0; | |
} | |
li { | |
display: inline-block; | |
margin: 0 10px; | |
} | |
a { | |
color: #42b983; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Test & coverage | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node 14 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: npm install | |
- name: Run the tests | |
run: npm run test:coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment