File tree 2 files changed +44
-0
lines changed
2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and push container
2
+ on :
3
+ push :
4
+ branches :
5
+ - main
6
+
7
+ jobs :
8
+ build-container :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - name : Checkout latest commit
12
+ uses : actions/checkout@v2
13
+ with :
14
+ ref : ${{ github.event.pull_request.head.sha }}
15
+ - name : Log into registry
16
+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
17
+ - name : Build and push container image
18
+ run : |
19
+ REGISTRY="ghcr.io/${{ github.repository_owner }}"
20
+ NAME="discord-bot"
21
+
22
+ ID="$(echo $REGISTRY/$NAME | tr '[A-Z]' '[a-z]')"
23
+ REF="$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')"
24
+
25
+ [[ "${{ github.ref }}" == "refs/tags/"* ]] && REF=$(echo $REF | sed -e 's/^v//')
26
+
27
+ [ "$REF" == "main" ] && REF=latest
28
+
29
+ docker build . \
30
+ --tag "$ID:$REF" \
31
+
32
+ docker push "$ID:$REF"
Original file line number Diff line number Diff line change
1
+ FROM node:alpine
2
+
3
+ WORKDIR /usr/src/app
4
+
5
+ RUN sed -i 's/dl-cdn/dl-5/g' /etc/apk/repositories && sed -i 's/http:/https:/g' /etc/apk/repositories
6
+
7
+ COPY . .
8
+
9
+ RUN npm install
10
+ RUN npm run build
11
+
12
+ CMD [ "npm" , "start" ]
You can’t perform that action at this time.
0 commit comments