Skip to content

Commit

Permalink
Merge pull request #110 from dokku/master
Browse files Browse the repository at this point in the history
Release 0.5.0
  • Loading branch information
josegonzalez authored Aug 6, 2023
2 parents 5197a25 + 168ed40 commit 6a40360
Show file tree
Hide file tree
Showing 20 changed files with 354 additions and 211 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ updates:
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
12 changes: 3 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@ on:
jobs:
build:
name: build
runs-on: ubuntu-20.04
strategy:
fail-fast: true
runs-on: ubuntu-22.04
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

steps:
- uses: actions/checkout@v2
- name: debug home
run: |
echo "$PWD"
echo "$HOME"
- uses: actions/checkout@v3
- name: make version
run: |
make version .env.docker
Expand All @@ -35,7 +29,7 @@ jobs:
- run: make build-in-docker
- run: make validate-in-docker
- name: upload packages
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: build
path: build/**/*
Expand Down
26 changes: 16 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@
name: 'lint'

# yamllint disable-line rule:truthy
on: [push, pull_request]
on:
pull_request:
branches:
- '*'
push:
branches:
- 'master'

jobs:
hadolint:
name: hadolint
runs-on: ubuntu-20.04
steps:
- name: Clone
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run hadolint
uses: hadolint/hadolint-action@c27bd9edc1e95eed30474db8f295ff5807ebca14
uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf
# v1.5.0 => c27bd9edc1e95eed30474db8f295ff5807ebca14

markdown-lint:
name: markdown-lint
runs-on: ubuntu-20.04
steps:
- name: Clone
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run markdown-lint
uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb
# v1.5.0 => 04d43ee9191307b50935a753da3b775ab695eceb
Expand All @@ -33,9 +39,9 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Clone
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run shellcheck
uses: ludeeus/action-shellcheck@94e0aab03ca135d11a35e5bfc14e6746dc56e7e9
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38
# 1.1.0 => 94e0aab03ca135d11a35e5bfc14e6746dc56e7e9
env:
SHELLCHECK_OPTS: -s bash
Expand All @@ -44,9 +50,9 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Clone
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run shfmt
uses: luizm/action-sh-checker@7f44869033b40ee4ffe7dc76c87a1bc66e3d025a
uses: luizm/action-sh-checker@76ab0b22e1f194e4a582edc7969df6485c4e9246
# v0.3.0 => 7f44869033b40ee4ffe7dc76c87a1bc66e3d025a
env:
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
Expand All @@ -60,9 +66,9 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Clone
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run yamllint
uses: ibiqlik/action-yamllint@c19bd0523a9011c3a3960fe6640a0882b59af15d
uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c
# v3.0.2 => c19bd0523a9011c3a3960fe6640a0882b59af15d
with:
config_file: '.github/linters/.yamllint.yml'
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM golang:1.19.0-buster
FROM golang:1.20.5-buster

# hadolint ignore=DL3027
RUN apt-get update \
&& apt install apt-transport-https build-essential curl gnupg2 jq lintian rpm rsync rubygems-integration ruby-dev ruby -qy \
&& apt install apt-transport-https build-essential curl gnupg2 jq lintian rsync rubygems-integration ruby-dev ruby -qy \
&& git clone https://github.com/bats-core/bats-core.git /tmp/bats-core \
&& /tmp/bats-core/install.sh /usr/local \
&& apt-get clean \
Expand Down
39 changes: 6 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MAINTAINER_NAME = Jose Diaz-Gonzalez
REPOSITORY = lambda-builder
HARDWARE = $(shell uname -m)
SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]')
BASE_VERSION ?= 0.4.0
BASE_VERSION ?= 0.5.0
IMAGE_NAME ?= $(MAINTAINER)/$(REPOSITORY)
PACKAGECLOUD_REPOSITORY ?= dokku/dokku-betafish

Expand Down Expand Up @@ -50,7 +50,6 @@ build: prebuild
@$(MAKE) build/deb/$(NAME)_$(VERSION)_amd64.deb
@$(MAKE) build/deb/$(NAME)_$(VERSION)_arm64.deb
@$(MAKE) build/deb/$(NAME)_$(VERSION)_armhf.deb
@$(MAKE) build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm

build-docker-image:
docker build --rm -q -f Dockerfile -t $(IMAGE_NAME):build .
Expand Down Expand Up @@ -156,27 +155,6 @@ build/deb/$(NAME)_$(VERSION)_armhf.deb: build/linux/$(NAME)-armhf
build/linux/$(NAME)-armhf=/usr/bin/$(NAME) \
LICENSE=/usr/share/doc/$(NAME)/copyright

build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm: build/linux/$(NAME)-amd64
export SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct) \
&& mkdir -p build/rpm \
&& fpm \
--architecture x86_64 \
--category utils \
--description "$$PACKAGE_DESCRIPTION" \
--input-type dir \
--license 'MIT License' \
--maintainer "$(MAINTAINER_NAME) <$(EMAIL)>" \
--name $(NAME) \
--output-type rpm \
--package build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm \
--rpm-os linux \
--url "https://github.com/$(MAINTAINER)/$(REPOSITORY)" \
--vendor "" \
--version $(VERSION) \
--verbose \
build/linux/$(NAME)-amd64=/usr/bin/$(NAME) \
LICENSE=/usr/share/doc/$(NAME)/copyright

clean:
rm -rf build release validation

Expand Down Expand Up @@ -208,32 +186,28 @@ release: build bin/gh-release bin/gh-release-body
cp build/deb/$(NAME)_$(VERSION)_amd64.deb release/$(NAME)_$(VERSION)_amd64.deb
cp build/deb/$(NAME)_$(VERSION)_arm64.deb release/$(NAME)_$(VERSION)_arm64.deb
cp build/deb/$(NAME)_$(VERSION)_armhf.deb release/$(NAME)_$(VERSION)_armhf.deb
cp build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm release/$(NAME)-$(VERSION)-1.x86_64.rpm
bin/gh-release create $(MAINTAINER)/$(REPOSITORY) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD)
bin/gh-release-body $(MAINTAINER)/$(REPOSITORY) v$(VERSION)

release-packagecloud:
@$(MAKE) release-packagecloud-deb
@$(MAKE) release-packagecloud-rpm

release-packagecloud-deb: build/deb/$(NAME)_$(VERSION)_amd64.deb build/deb/$(NAME)_$(VERSION)_arm64.deb build/deb/$(NAME)_$(VERSION)_armhf.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/bionic build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/focal build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/jammy build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/stretch build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/buster build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bullseye build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bookworm build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/focal build/deb/$(NAME)_$(VERSION)_arm64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/jammy build/deb/$(NAME)_$(VERSION)_arm64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bullseye build/deb/$(NAME)_$(VERSION)_arm64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bookworm build/deb/$(NAME)_$(VERSION)_arm64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/focal build/deb/$(NAME)_$(VERSION)_armhf.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/jammy build/deb/$(NAME)_$(VERSION)_armhf.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/raspbian/buster build/deb/$(NAME)_$(VERSION)_armhf.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/raspbian/bullseye build/deb/$(NAME)_$(VERSION)_armhf.deb

release-packagecloud-rpm: build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm
package_cloud push $(PACKAGECLOUD_REPOSITORY)/el/7 build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm

validate:
mkdir -p validation
lintian build/deb/$(NAME)_$(VERSION)_amd64.deb || true
Expand All @@ -248,13 +222,12 @@ validate:
cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_amd64.deb
cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_arm64.deb
cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_armhf.deb
cd validation && rpm2cpio ../build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm > $(NAME)-$(VERSION)-1.x86_64.cpio
ls -lah build/deb build/rpm validation
ls -lah build/deb validation
sha1sum build/deb/$(NAME)_$(VERSION)_amd64.deb
sha1sum build/deb/$(NAME)_$(VERSION)_arm64.deb
sha1sum build/deb/$(NAME)_$(VERSION)_armhf.deb
sha1sum build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm
cd /home/runner/work/$(REPOSITORY)/$(REPOSITORY) && bats test.bats

prebuild:
true
git config --global --add safe.directory $(shell pwd)
git status
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ I don't want to go through the motions of figuring out the correct way to build

```shell
# substitute the version number as desired
go build -ldflags "-X main.Version=0.4.0"
go build -ldflags "-X main.Version=0.5.0"
```

## Usage
Expand Down Expand Up @@ -57,7 +57,7 @@ A `builder` can be chosen by a flag. Note that while a `builder` may be selected

```shell
lambda-builder build --generate-image --builder dotnet
````
```

#### Building an image

Expand All @@ -81,7 +81,7 @@ By default, any web process started by the built image starts on port `9001`. Th
```shell
# build the image and ensure it starts on port 5000 by default
lambda-builder build --generate-image --port 5000
````
```

Custom environment variables can be supplied for the built image by specifying one or more `--image-env` flags. The `--image-env` flag takes `KEY=VALUE` pairs.

Expand All @@ -94,7 +94,7 @@ The `build-image` and `run-image` can also be specified as flags:

```shell
lambda-builder build --generate-image --build-image "mlupin/docker-lambda:dotnetcore3.1-build" --run-image "mlupin/docker-lambda:dotnetcore3.1"
````
```

A generated image can be run locally with the following line:

Expand Down
7 changes: 0 additions & 7 deletions builders/dotnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ indent() {
sed -u "s/^/ /"
}
puts-header() {
echo "=====> $*"
}
puts-step() {
echo "-----> $*"
}
Expand Down Expand Up @@ -103,11 +99,8 @@ hook-package() {
puts-step "Creating package at lambda.zip"
zip -q -r lambda.zip ./*
mv lambda.zip /tmp/task/lambda.zip
rm -rf lambda.zip
}
cp -a /tmp/task/. /var/task
hook-pre-compile
install-dotnet
hook-post-compile
Expand Down
10 changes: 3 additions & 7 deletions builders/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ indent() {
sed -u "s/^/ /"
}
puts-header() {
echo "=====> $*"
}
puts-step() {
echo "-----> $*"
}
Expand Down Expand Up @@ -117,11 +113,11 @@ hook-package() {
puts-step "Creating package at lambda.zip"
zip -q -r lambda.zip bootstrap
mv lambda.zip /tmp/task/lambda.zip
rm -rf lambda.zip
mv lambda.zip /var/task/lambda.zip
}
cp -a /tmp/task/. /go/src/handler
cp -a /var/task/. /go/src/handler
cd /go/src/handler
hook-pre-compile
install-gomod
hook-post-compile
Expand Down
Loading

0 comments on commit 6a40360

Please sign in to comment.