Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
chore: add build_dev workflow (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
StewartJingga authored Jul 25, 2023
1 parent acdebe3 commit f61a718
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build Dev

on: workflow_dispatch

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
file: "./Dockerfile.dev"
tags: |
gotocompany/dex:dev
19 changes: 19 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM goreleaser/goreleaser:v1.19.2 as base
WORKDIR /build/
COPY . .
RUN ["goreleaser", "build", "--snapshot", "--rm-dist", "--single-target"]

FROM alpine:3.13

COPY --from=base /build/dist/dex_linux_amd64_v1/dex /usr/bin/dex
RUN apk update
RUN apk --no-cache add ca-certificates bash
RUN GRPC_HEALTH_PROBE_VERSION=v0.4.5 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe

# glibc compatibility library, since go binaries
# don't work well with musl libc that alpine uses
RUN apk add libc6-compat

CMD ["dex", "server", "start"]
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ test-coverage: test
@echo "Generating coverage report..."
@go tool cover -html=${COVERAGE_DIR}/coverage.out

build: clean
@mkdir -p ${BUILD_DIR}
@echo "Running build for '${VERSION}' in '${BUILD_DIR}/'..."
@CGO_ENABLED=0 go build -ldflags '-X "${NAME}/pkg/version.Version=${VERSION}" -X "${NAME}/pkg/version.Commit=${COMMIT}" -X "${NAME}/pkg/version.BuildTime=${BUILD_TIME}"' -o ${BUILD_DIR}/${EXE}
build:
@goreleaser build --snapshot --rm-dist --single-target

download:
@go mod download
Expand Down

0 comments on commit f61a718

Please sign in to comment.