Skip to content

Commit

Permalink
Added build and push image
Browse files Browse the repository at this point in the history
  • Loading branch information
text-adi committed Apr 4, 2024
1 parent e563ee6 commit dd0c381
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,25 @@ jobs:
name: Generation vars
runs-on: ubuntu-latest
outputs:
prefix-test: ${{ steps.basic.outputs.prefix_test }}
prefix-latest: ${{ steps.basic.outputs.last_tag }}
steps:
- name: Get version
id: _tmp_last_tag
env:
DOCKERHUB_REPO: ...
DOCKERHUB_IMAGE: ...
run: |
version=$(curl -L --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=1000" | \
jq '.results | .[] | .name' -r | \
sed 's/latest//' | \
sort --version-sort | \
tail -n 1)
echo "value=$version" >> $GITHUB_OUTPUT
- name: Create basic vars
id: basic
run: |
echo "prefix_test=test" >> $GITHUB_OUTPUT
echo "last_tag=${{ steps._tmp_last_tag.outputs.value }}" >> $GITHUB_OUTPUT
lint-dockerfile:
needs: [ vars ]
Expand Down Expand Up @@ -59,20 +72,22 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set test prefix
id: tag
- name: Create image tag
id: image_tag
run: |
echo "test=${{ secrets.DOCKER_USERNAME }}/${{ vars.APP_NAME }}:${{ needs.vars.outputs.prefix-test }}" >> $GITHUB_OUTPUT
echo "value=${{ secrets.DOCKER_USERNAME }}/${{ vars.APP_NAME }}:${{ needs.vars.outputs.prefix-latest }}" >> "$GITHUB_OUTPUT"
- name: Build docker image
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
file: Dockerfile
load: true
push: true
provenance: false
target: local
tags: |
${{ steps.tag.outputs.test }}
${{ steps.image_tag.outputs.value }}
cache-from: type=gha
cache-to: type=gha,mode=max

Empty file added README.md
Empty file.
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3.9"

services:
app:
build:
dockerfile: Dockerfile
context: .
args:
BASE_IMAGE: textadi/aws-kubectl:2.15.35-1.29.3
environment:
DEBUG: true
NAMESPACE_NAME: "default"
AWS_ACCOUNT: "test"
ECR_TOKEN: "test"
AWS_ACCESS_KEY_ID: "test"
AWS_SECRET_ACCESS_KEY: "test"

tty: true

0 comments on commit dd0c381

Please sign in to comment.