forked from morethanwords/tweb
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (35 loc) · 1.39 KB
/
production-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Docker Image Build CI
on:
push:
tags:
- 'tag/build-docker-image/*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Read version from .env
id: env
run: echo "::set-output name=PRODUCTION_BUILD_VERSION::$(grep ^PRODUCTION_BUILD_VERSION= .env | cut -d'=' -f2)"
- name: Build the Docker image for latest
run: docker build -f ./.docker/Dockerfile_production -t ${{ vars.DOCKERHUB_USERNAME}}/tweb:latest .
- name: Build the Docker image for specific version
run: |
version=${{ steps.env.outputs.PRODUCTION_BUILD_VERSION }}
docker build -f ./.docker/Dockerfile_production -t ${{ vars.DOCKERHUB_USERNAME}}/tweb:${version} .
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ vars.DOCKERHUB_USERNAME}}" --password-stdin
- name: Push versioned image
run: |
version=${{ steps.env.outputs.PRODUCTION_BUILD_VERSION }}
docker push ${{ vars.DOCKERHUB_USERNAME}}/tweb:${version}
- name: Push latest image
run: |
docker push ${{ vars.DOCKERHUB_USERNAME}}/tweb:latest