Skip to content

Commit

Permalink
update workflow and fix Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
asiyani committed Jan 10, 2025
1 parent 4181787 commit 861a3a5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to Quay.io Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: quay.io
username: utilitywarehouse+drone_ci
password: ${{ secrets.SYSTEM_QUAY_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
push: true
Expand Down
25 changes: 16 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
FROM golang:1.22-alpine AS build
WORKDIR /go/src/github.com/utilitywarehouse/registry-browser
COPY . /go/src/github.com/utilitywarehouse/registry-browser
ENV CGO_ENABLED 0
RUN apk --no-cache add git \
&& go get -t ./... \
&& go test ./... \
&& go build -o /registry-browser .
FROM golang:1.23-alpine AS build

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY . .

RUN go test -v -cover ./... \
&& CGO_ENABLED=0 go build -o /registry-browser .

FROM alpine:3.20
ADD templates /templates
ADD static /static
COPY --from=build /registry-browser /registry-browser
COPY --from=build /workspace/registry-browser /registry-browser

ENTRYPOINT [ "/registry-browser" ]

0 comments on commit 861a3a5

Please sign in to comment.