-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: move from travis to github actions
- remove push image from travis - add builder/multi stage Dockerfile - add make's docker-builder step - add workflow: build image - update workflow: add build+tests for push events on `master` and `release-*`
- Loading branch information
1 parent
365dc28
commit 19c275c
Showing
5 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'release-*' | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.15 | ||
- uses: actions/checkout@v2 | ||
- name: Run build | ||
run: go build -o haproxy-ingress pkg/main.go | ||
- name: Run tests | ||
run: go test ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: image | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
jobs: | ||
build-image: | ||
runs-on: ubuntu-latest | ||
env: | ||
EXTRA_TAGS: | ||
steps: | ||
- name: Configure envvars | ||
run: | | ||
GIT_TAG="${GITHUB_REF#refs/tags/}" | ||
TAGS=$( | ||
for repository in quay.io/jcmoraisjr jcmoraisjr; do | ||
for project in haproxy-ingress; do | ||
for tag in "$GIT_TAG" ${{ env.EXTRA_TAGS }}; do | ||
echo -n "${repository}/${project}:${tag}," | ||
done | ||
done | ||
done | ||
) | ||
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV | ||
echo "TAGS=$TAGS" >> $GITHUB_ENV | ||
- uses: actions/checkout@v2 | ||
- uses: docker/login-action@v1 | ||
with: | ||
username: jcmoraisjr | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- uses: docker/login-action@v1 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_TOKEN }} | ||
- uses: docker/setup-buildx-action@v1 | ||
- uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: builder/Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
build-args: | | ||
GIT_TAG=${{ env.GIT_TAG }} | ||
tags: ${{ env.TAGS }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright 2021 The HAProxy Ingress Controller Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM golang:1.13.15-alpine AS builder | ||
|
||
ARG GIT_TAG | ||
|
||
RUN apk --no-cache add git | ||
|
||
COPY / /src | ||
|
||
RUN cd /src\ | ||
&& GIT_TAG=${GIT_TAG:-latest}\ | ||
&& GIT_COMMIT=git-$(git rev-parse --short HEAD)\ | ||
&& GIT_REPO=$(git config --get remote.origin.url)\ | ||
&& VERSION_PKG=github.com/jcmoraisjr/haproxy-ingress/pkg/version\ | ||
&& CGO_ENABLED=0 go build\ | ||
-ldflags "-s -w -X ${VERSION_PKG}.RELEASE=${GIT_TAG} -X ${VERSION_PKG}.COMMIT=${GIT_COMMIT} -X ${VERSION_PKG}.REPO=${GIT_REPO}"\ | ||
-o haproxy-ingress pkg/main.go | ||
|
||
FROM haproxy:2.1.12-alpine | ||
|
||
RUN apk --no-cache add socat openssl lua5.3 lua-socket dumb-init | ||
|
||
COPY rootfs/ / | ||
COPY --from=builder /src/haproxy-ingress /haproxy-ingress-controller | ||
|
||
RUN deluser haproxy\ | ||
&& addgroup -g 1001 haproxy\ | ||
&& adduser -u 1001 -G haproxy -D -s /bin/false haproxy\ | ||
&& mkdir -p /var/empty /etc/haproxy /var/lib/haproxy /var/run/haproxy\ | ||
&& chown -R haproxy:haproxy /etc/haproxy /var/lib/haproxy /var/run/haproxy\ | ||
&& chmod 0 /var/empty | ||
|
||
STOPSIGNAL SIGTERM | ||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/start.sh"] |