Skip to content

Commit

Permalink
feat: add dockerfile and actions to push image
Browse files Browse the repository at this point in the history
  • Loading branch information
ajutamangdev committed Sep 11, 2024
1 parent d796975 commit 7f0d99e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/image_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build Docker Image
on:
push:
branches:
- main
jobs:
build:
name: push docker image to docker hub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: login to docker hub
id: docker-hub
env:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_PASSWORD}}
run: |
docker login -u $username -p $password
- name: build the docker image
id: build-docker-image
run: |
ls -la
docker build -t docker push ${{secrets.DOCKERHUB_USERNAME}}/s3khoj:latest
- name: push the docker image
id: push-docker-image
run: docker push ${{secrets.DOCKERHUB_USERNAME}}/s3khoj:latest
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build
FROM golang:1.22-alpine AS build-env
RUN apk add build-base
WORKDIR /app
COPY . /app
RUN go mod tidy
RUN go build -o S3Khoj main.go

# Release
FROM alpine:3.18.6
RUN apk upgrade --no-cache \
&& apk add --no-cache bind-tools
COPY --from=build-env /app/S3Khoj /usr/local/bin/S3Khoj

ENTRYPOINT [ "S3Khoj" ]

0 comments on commit 7f0d99e

Please sign in to comment.