Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f9f65c60e | |||
| fcdfc4e202 | |||
| 508df82452 | |||
|
|
018dd9ef61 | ||
|
|
a6e0171dd5 | ||
|
|
8ad8465153 | ||
|
|
aacad6eca9 | ||
|
|
3705ed06ac | ||
|
|
6d4ce8c5ac | ||
|
|
492e84d4b0 | ||
|
|
71af02818a | ||
|
|
39f70cdada | ||
|
|
38f0f1bd3f | ||
|
|
c8b68d31ab | ||
|
|
046362a937 | ||
|
|
566cff614d | ||
|
|
cd4f459538 | ||
|
|
494d08375c | ||
|
|
904449e95e | ||
|
|
a8757bdbe0 | ||
|
|
d645570199 | ||
|
|
2e22a26475 |
185
.drone.yml
185
.drone.yml
@ -1,173 +1,28 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: golang
|
|
||||||
commands:
|
|
||||||
- go test ./...
|
|
||||||
- sh scripts/build.sh
|
|
||||||
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
repo: plugins/buildah-docker
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: linux-amd64
|
|
||||||
daemon_off: false
|
|
||||||
dockerfile: docker/docker/Dockerfile.linux.amd64
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
- name: gcr
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
repo: plugins/buildah-gcr
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: linux-amd64
|
|
||||||
daemon_off: false
|
|
||||||
dockerfile: docker/gcr/Dockerfile.linux.amd64
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
- name: ecr
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
repo: plugins/buildah-ecr
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: linux-amd64
|
|
||||||
daemon_off: false
|
|
||||||
dockerfile: docker/ecr/Dockerfile.linux.amd64
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
- name: acr
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
repo: plugins/buildah-acr
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: linux-amd64
|
|
||||||
daemon_off: false
|
|
||||||
dockerfile: docker/acr/Dockerfile.linux.amd64
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
- name: heroku
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
repo: plugins/buildah-heroku
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: linux-amd64
|
|
||||||
daemon_off: false
|
|
||||||
dockerfile: docker/heroku/Dockerfile.linux.amd64
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
type: docker
|
||||||
name: notifications-docker
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: manifest-docker
|
- name: build
|
||||||
pull: always
|
image: golang:alpine
|
||||||
image: plugins/manifest
|
commands:
|
||||||
settings:
|
- go test ./...
|
||||||
auto_tag: true
|
- sh scripts/build.sh
|
||||||
ignore_missing: true
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
spec: docker/docker/manifest.tmpl
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
|
|
||||||
- name: manifest-gcr
|
- name: docker
|
||||||
pull: always
|
image: plugins/docker
|
||||||
image: plugins/manifest
|
settings:
|
||||||
settings:
|
repo: cr.smcm.xyz/drone-plugins/buildah
|
||||||
auto_tag: true
|
tags:
|
||||||
ignore_missing: true
|
- latest
|
||||||
password:
|
- ${DRONE_COMMIT_SHA}
|
||||||
from_secret: docker_password
|
daemon_off: true
|
||||||
spec: docker/gcr/manifest.tmpl
|
dockerfile: docker/docker/Dockerfile.linux.amd64
|
||||||
username:
|
cache_from: cr.smcm.xyz/drone-plugins/buildah
|
||||||
from_secret: docker_username
|
|
||||||
|
|
||||||
- name: manifest-ecr
|
|
||||||
pull: always
|
|
||||||
image: plugins/manifest
|
|
||||||
settings:
|
|
||||||
auto_tag: true
|
|
||||||
ignore_missing: true
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
spec: docker/ecr/manifest.tmpl
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
|
|
||||||
- name: manifest-acr
|
|
||||||
pull: always
|
|
||||||
image: plugins/manifest
|
|
||||||
settings:
|
|
||||||
auto_tag: true
|
|
||||||
ignore_missing: true
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
spec: docker/acr/manifest.tmpl
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
|
|
||||||
- name: manifest-heroku
|
|
||||||
pull: always
|
|
||||||
image: plugins/manifest
|
|
||||||
settings:
|
|
||||||
auto_tag: true
|
|
||||||
ignore_missing: true
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
spec: docker/heroku/manifest.tmpl
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
ref:
|
branch: master
|
||||||
- refs/heads/main
|
event:
|
||||||
- "refs/tags/**"
|
- push
|
||||||
|
- custom
|
||||||
depends_on:
|
- cron
|
||||||
- default
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
[](http://godoc.org/github.com/drone-plugins/drone-buildah)
|
[](http://godoc.org/github.com/drone-plugins/drone-buildah)
|
||||||
[](https://goreportcard.com/report/github.com/drone-plugins/drone-buildah)
|
[](https://goreportcard.com/report/github.com/drone-plugins/drone-buildah)
|
||||||
|
|
||||||
Drone plugin uses buildah to build and publish Docker images to a container registry. For the usage information and a listing of the available options please take a look at [the docs](http://plugins.drone.io/drone-plugins/drone-buildah/).
|
Drone plugin uses buildah to build and publish Docker images to a container registry. For the usage information and a listing of the available options please take a look at [the docs](https://plugins.drone.io/plugins/buildah).
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
@ -66,7 +66,6 @@ docker run --rm \
|
|||||||
-e PLUGIN_REPO=octocat/hello-world \
|
-e PLUGIN_REPO=octocat/hello-world \
|
||||||
-e DRONE_COMMIT_SHA=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab \
|
-e DRONE_COMMIT_SHA=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab \
|
||||||
--cap-add=SYS_ADMIN \
|
--cap-add=SYS_ADMIN \
|
||||||
-v /var/lib/containers/:/var/lib/containers/:Z \
|
|
||||||
-v $(pwd):$(pwd) \
|
-v $(pwd):$(pwd) \
|
||||||
-w $(pwd) \
|
-w $(pwd) \
|
||||||
plugins/buildah-docker --dry-run
|
plugins/buildah-docker --dry-run
|
||||||
|
|||||||
@ -182,6 +182,46 @@ func main() {
|
|||||||
Usage: "additional host:IP mapping",
|
Usage: "additional host:IP mapping",
|
||||||
EnvVar: "PLUGIN_ADD_HOST",
|
EnvVar: "PLUGIN_ADD_HOST",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "s3-local-cache-dir",
|
||||||
|
Usage: "local directory for S3 based cache",
|
||||||
|
EnvVar: "PLUGIN_S3_LOCAL_CACHE_DIR",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "s3-bucket",
|
||||||
|
Usage: "S3 bucket name",
|
||||||
|
EnvVar: "PLUGIN_S3_BUCKET",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "s3-endpoint",
|
||||||
|
Usage: "S3 endpoint address",
|
||||||
|
EnvVar: "PLUGIN_S3_ENDPOINT",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "s3-region",
|
||||||
|
Usage: "S3 region",
|
||||||
|
EnvVar: "PLUGIN_S3_REGION",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "s3-key",
|
||||||
|
Usage: "S3 access key",
|
||||||
|
EnvVar: "PLUGIN_S3_ACCESS_KEY",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "s3-secret",
|
||||||
|
Usage: "S3 access secret",
|
||||||
|
EnvVar: "PLUGIN_S3_SECRET",
|
||||||
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "s3-use-ssl",
|
||||||
|
Usage: "Enable SSL for S3 connections",
|
||||||
|
EnvVar: "PLUGIN_S3_USE_SSL",
|
||||||
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "layers",
|
||||||
|
Usage: "User Layers",
|
||||||
|
EnvVar: "PLUGIN_LAYERS",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@ -221,6 +261,14 @@ func run(c *cli.Context) error {
|
|||||||
NoCache: c.Bool("no-cache"),
|
NoCache: c.Bool("no-cache"),
|
||||||
AddHost: c.StringSlice("add-host"),
|
AddHost: c.StringSlice("add-host"),
|
||||||
Quiet: c.Bool("quiet"),
|
Quiet: c.Bool("quiet"),
|
||||||
|
S3CacheDir: c.String("s3-local-cache-dir"),
|
||||||
|
S3Bucket: c.String("s3-bucket"),
|
||||||
|
S3Endpoint: c.String("s3-endpoint"),
|
||||||
|
S3Region: c.String("s3-region"),
|
||||||
|
S3Key: c.String("s3-key"),
|
||||||
|
S3Secret: c.String("s3-secret"),
|
||||||
|
S3UseSSL: c.Bool("s3-use-ssl"),
|
||||||
|
Layers: c.Bool("layers"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
61
docker.go
61
docker.go
@ -5,6 +5,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -44,6 +45,14 @@ type (
|
|||||||
NoCache bool // Docker build no-cache
|
NoCache bool // Docker build no-cache
|
||||||
AddHost []string // Docker build add-host
|
AddHost []string // Docker build add-host
|
||||||
Quiet bool // Docker build quiet
|
Quiet bool // Docker build quiet
|
||||||
|
S3CacheDir string
|
||||||
|
S3Bucket string
|
||||||
|
S3Endpoint string
|
||||||
|
S3Region string
|
||||||
|
S3Key string
|
||||||
|
S3Secret string
|
||||||
|
S3UseSSL bool
|
||||||
|
Layers bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin defines the Docker plugin parameters.
|
// Plugin defines the Docker plugin parameters.
|
||||||
@ -59,23 +68,28 @@ type (
|
|||||||
func (p Plugin) Exec() error {
|
func (p Plugin) Exec() error {
|
||||||
// Create Auth Config File
|
// Create Auth Config File
|
||||||
if p.Login.Config != "" {
|
if p.Login.Config != "" {
|
||||||
homeDir, err := os.UserHomeDir()
|
user, err := user.Current()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to find home directory: %s", err)
|
return fmt.Errorf("Error getting the current user: %s", err)
|
||||||
|
}
|
||||||
|
root := fmt.Sprintf("/var/tmp/%s/containers/containers/", user.Uid)
|
||||||
|
if err := os.MkdirAll(root, 0777); err != nil {
|
||||||
|
return fmt.Errorf("Error writing runtime dir: %s", err)
|
||||||
}
|
}
|
||||||
dockerHome := fmt.Sprintf("%s/.docker/config.json", homeDir)
|
|
||||||
os.MkdirAll(dockerHome, 0600)
|
|
||||||
|
|
||||||
path := filepath.Join(dockerHome, "config.json")
|
path := filepath.Join(root, "auth.json")
|
||||||
err = ioutil.WriteFile(path, []byte(p.Login.Config), 0600)
|
if err := ioutil.WriteFile(path, []byte(p.Login.Config), 0600); err != nil {
|
||||||
if err != nil {
|
return fmt.Errorf("Error writing auth.json: %s", err)
|
||||||
return fmt.Errorf("Error writing config.json: %s", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Config written to %s\n", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// login to the Docker registry
|
// login to the Docker registry
|
||||||
if p.Login.Password != "" {
|
if p.Login.Password != "" {
|
||||||
cmd := commandLogin(p.Login)
|
cmd := commandLogin(p.Login)
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error authenticating: %s", err)
|
return fmt.Errorf("Error authenticating: %s", err)
|
||||||
@ -184,6 +198,7 @@ func commandInfo() *exec.Cmd {
|
|||||||
func commandBuild(build Build) *exec.Cmd {
|
func commandBuild(build Build) *exec.Cmd {
|
||||||
args := []string{
|
args := []string{
|
||||||
"bud",
|
"bud",
|
||||||
|
"--storage-driver", "vfs",
|
||||||
"-f", build.Dockerfile,
|
"-f", build.Dockerfile,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,6 +232,30 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
if build.Quiet {
|
if build.Quiet {
|
||||||
args = append(args, "--quiet")
|
args = append(args, "--quiet")
|
||||||
}
|
}
|
||||||
|
if build.Layers {
|
||||||
|
args = append(args, "--layers=true")
|
||||||
|
if build.S3CacheDir != "" {
|
||||||
|
args = append(args, "--s3-local-cache-dir", build.S3CacheDir)
|
||||||
|
if build.S3Bucket != "" {
|
||||||
|
args = append(args, "--s3-bucket", build.S3Bucket)
|
||||||
|
}
|
||||||
|
if build.S3Endpoint != "" {
|
||||||
|
args = append(args, "--s3-endpoint", build.S3Endpoint)
|
||||||
|
}
|
||||||
|
if build.S3Region != "" {
|
||||||
|
args = append(args, "--s3-region", build.S3Region)
|
||||||
|
}
|
||||||
|
if build.S3Key != "" {
|
||||||
|
args = append(args, "--s3-key", build.S3Key)
|
||||||
|
}
|
||||||
|
if build.S3Secret != "" {
|
||||||
|
args = append(args, "--s3-secret", build.S3Secret)
|
||||||
|
}
|
||||||
|
if build.S3UseSSL {
|
||||||
|
args = append(args, "--s3-use-ssl=true")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if build.AutoLabel {
|
if build.AutoLabel {
|
||||||
labelSchema := []string{
|
labelSchema := []string{
|
||||||
@ -297,14 +336,14 @@ func commandTag(build Build, tag string) *exec.Cmd {
|
|||||||
target = fmt.Sprintf("%s:%s", build.Repo, tag)
|
target = fmt.Sprintf("%s:%s", build.Repo, tag)
|
||||||
)
|
)
|
||||||
return exec.Command(
|
return exec.Command(
|
||||||
buildahExe, "tag", source, target,
|
buildahExe, "tag", "--storage-driver", "vfs", source, target,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper function to create the docker push command.
|
// helper function to create the docker push command.
|
||||||
func commandPush(build Build, tag string) *exec.Cmd {
|
func commandPush(build Build, tag string) *exec.Cmd {
|
||||||
target := fmt.Sprintf("%s:%s", build.Repo, tag)
|
target := fmt.Sprintf("%s:%s", build.Repo, tag)
|
||||||
return exec.Command(buildahExe, "push", target)
|
return exec.Command(buildahExe, "push", "--storage-driver", "vfs", target)
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper to check if args match "docker prune"
|
// helper to check if args match "docker prune"
|
||||||
@ -318,7 +357,7 @@ func isCommandRmi(args []string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func commandRmi(tag string) *exec.Cmd {
|
func commandRmi(tag string) *exec.Cmd {
|
||||||
return exec.Command(buildahExe, "rmi", tag)
|
return exec.Command(buildahExe, "--storage-driver", "vfs", "rmi", tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
// trace writes each command to stdout with the command wrapped in an xml
|
// trace writes each command to stdout with the command wrapped in an xml
|
||||||
|
|||||||
@ -18,5 +18,6 @@ USER build
|
|||||||
WORKDIR /home/build
|
WORKDIR /home/build
|
||||||
|
|
||||||
# Add plugin binary
|
# Add plugin binary
|
||||||
|
ADD release/linux/amd64/drone-docker /bin/
|
||||||
ADD release/linux/amd64/drone-acr /bin/
|
ADD release/linux/amd64/drone-acr /bin/
|
||||||
ENTRYPOINT ["/bin/drone-acr"]
|
ENTRYPOINT ["/bin/drone-acr"]
|
||||||
|
|||||||
@ -1,22 +1,28 @@
|
|||||||
# Source for dockerfile:
|
FROM alpine:3.18
|
||||||
# https://github.com/containers/buildah/blob/master/docs/tutorials/05-openshift-rootless-bud.md
|
|
||||||
FROM quay.io/buildah/stable:v1.14.8
|
|
||||||
|
|
||||||
RUN touch /etc/subgid /etc/subuid \
|
RUN addgroup \
|
||||||
&& chmod g=u /etc/subgid /etc/subuid /etc/passwd \
|
-g 1000 \
|
||||||
&& echo build:10000:65536 > /etc/subuid \
|
build
|
||||||
&& echo build:10000:65536 > /etc/subgid
|
|
||||||
|
|
||||||
# Use chroot since the default runc does not work when running rootless
|
RUN adduser \
|
||||||
RUN echo "export BUILDAH_ISOLATION=chroot" >> /home/build/.bashrc
|
-h /home/build \
|
||||||
|
-s /bin/sh \
|
||||||
|
-u 1000 \
|
||||||
|
-G build \
|
||||||
|
-D \
|
||||||
|
build
|
||||||
|
|
||||||
# Use VFS since fuse does not work
|
RUN echo -e "build:1:999\nbuild:1001:64535" > /etc/subuid && \
|
||||||
RUN mkdir -p /home/build/.config/containers \
|
echo -e "build:1:999\nbuild:1001:64535" > /etc/subgid && \
|
||||||
&& echo "driver=\"vfs\"" > /home/build/.config/containers/storage.conf
|
mkdir -p /home/build/.local/share/containers && \
|
||||||
|
mkdir -p /home/build/.config/containers && \
|
||||||
|
chown -R build:build /home/build
|
||||||
|
|
||||||
|
RUN apk add --no-cache buildah
|
||||||
|
|
||||||
|
ADD release/linux/amd64/drone-docker /bin/
|
||||||
|
|
||||||
|
ENV STORAGE_DRIVER vfs
|
||||||
USER build
|
USER build
|
||||||
WORKDIR /home/build
|
WORKDIR /home/build
|
||||||
|
|
||||||
# Add plugin binary
|
|
||||||
ADD release/linux/amd64/drone-docker /bin/
|
|
||||||
ENTRYPOINT ["/bin/drone-docker"]
|
ENTRYPOINT ["/bin/drone-docker"]
|
||||||
@ -1,22 +1,41 @@
|
|||||||
# Source for dockerfile:
|
FROM fedora
|
||||||
# https://github.com/containers/buildah/blob/master/docs/tutorials/05-openshift-rootless-bud.md
|
|
||||||
FROM quay.io/buildah/stable:v1.14.8
|
|
||||||
|
|
||||||
RUN touch /etc/subgid /etc/subuid \
|
RUN dnf -y install \
|
||||||
&& chmod g=u /etc/subgid /etc/subuid /etc/passwd \
|
make \
|
||||||
&& echo build:10000:65536 > /etc/subuid \
|
golang \
|
||||||
&& echo build:10000:65536 > /etc/subgid
|
bats \
|
||||||
|
btrfs-progs-devel \
|
||||||
|
device-mapper-devel \
|
||||||
|
glib2-devel \
|
||||||
|
gpgme-devel \
|
||||||
|
libassuan-devel \
|
||||||
|
libseccomp-devel \
|
||||||
|
git \
|
||||||
|
bzip2 \
|
||||||
|
go-md2man \
|
||||||
|
runc \
|
||||||
|
containers-common \
|
||||||
|
skopeo-containers
|
||||||
|
|
||||||
# Use chroot since the default runc does not work when running rootless
|
# Workaround - the first install somehow leaves the golang in a bad state
|
||||||
RUN echo "export BUILDAH_ISOLATION=chroot" >> /home/build/.bashrc
|
RUN dnf -y install golang
|
||||||
|
|
||||||
# Use VFS since fuse does not work
|
RUN mkdir /root/buildah && \
|
||||||
RUN mkdir -p /home/build/.config/containers \
|
cd /root/buildah && \
|
||||||
&& echo "driver=\"vfs\"" > /home/build/.config/containers/storage.conf
|
git clone https://github.com/harness/buildah.git ./src/github.com/containers/buildah
|
||||||
|
|
||||||
|
RUN cd /root/buildah/src/github.com/containers/buildah && make && sudo make install
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FROM quay.io/buildah/stable:v1.23.0
|
||||||
|
|
||||||
USER build
|
USER build
|
||||||
WORKDIR /home/build
|
WORKDIR /home/build
|
||||||
|
RUN export STORAGE_DRIVER=vfs
|
||||||
|
COPY --from=0 /root/buildah/src/github.com/containers/buildah/bin/. /bin/
|
||||||
|
|
||||||
# Add plugin binary
|
# Add plugin binary
|
||||||
|
ADD release/linux/amd64/drone-docker /bin/
|
||||||
ADD release/linux/amd64/drone-ecr /bin/
|
ADD release/linux/amd64/drone-ecr /bin/
|
||||||
ENTRYPOINT ["/bin/drone-ecr"]
|
ENTRYPOINT ["/bin/drone-ecr"]
|
||||||
|
|||||||
@ -1,22 +1,41 @@
|
|||||||
# Source for dockerfile:
|
FROM fedora
|
||||||
# https://github.com/containers/buildah/blob/master/docs/tutorials/05-openshift-rootless-bud.md
|
|
||||||
FROM quay.io/buildah/stable:v1.14.8
|
|
||||||
|
|
||||||
RUN touch /etc/subgid /etc/subuid \
|
RUN dnf -y install \
|
||||||
&& chmod g=u /etc/subgid /etc/subuid /etc/passwd \
|
make \
|
||||||
&& echo build:10000:65536 > /etc/subuid \
|
golang \
|
||||||
&& echo build:10000:65536 > /etc/subgid
|
bats \
|
||||||
|
btrfs-progs-devel \
|
||||||
|
device-mapper-devel \
|
||||||
|
glib2-devel \
|
||||||
|
gpgme-devel \
|
||||||
|
libassuan-devel \
|
||||||
|
libseccomp-devel \
|
||||||
|
git \
|
||||||
|
bzip2 \
|
||||||
|
go-md2man \
|
||||||
|
runc \
|
||||||
|
containers-common \
|
||||||
|
skopeo-containers
|
||||||
|
|
||||||
# Use chroot since the default runc does not work when running rootless
|
# Workaround - the first install somehow leaves the golang in a bad state
|
||||||
RUN echo "export BUILDAH_ISOLATION=chroot" >> /home/build/.bashrc
|
RUN dnf -y install golang
|
||||||
|
|
||||||
# Use VFS since fuse does not work
|
RUN mkdir /root/buildah && \
|
||||||
RUN mkdir -p /home/build/.config/containers \
|
cd /root/buildah && \
|
||||||
&& echo "driver=\"vfs\"" > /home/build/.config/containers/storage.conf
|
git clone https://github.com/harness/buildah.git ./src/github.com/containers/buildah
|
||||||
|
|
||||||
|
RUN cd /root/buildah/src/github.com/containers/buildah && make && sudo make install
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FROM quay.io/buildah/stable:v1.23.0
|
||||||
|
|
||||||
USER build
|
USER build
|
||||||
WORKDIR /home/build
|
WORKDIR /home/build
|
||||||
|
RUN export STORAGE_DRIVER=vfs
|
||||||
|
COPY --from=0 /root/buildah/src/github.com/containers/buildah/bin/. /bin/
|
||||||
|
|
||||||
# Add plugin binary
|
# Add plugin binary
|
||||||
|
ADD release/linux/amd64/drone-docker /bin/
|
||||||
ADD release/linux/amd64/drone-gcr /bin/
|
ADD release/linux/amd64/drone-gcr /bin/
|
||||||
ENTRYPOINT ["/bin/drone-gcr"]
|
ENTRYPOINT ["/bin/drone-gcr"]
|
||||||
|
|||||||
@ -1,22 +1,41 @@
|
|||||||
# Source for dockerfile:
|
FROM fedora
|
||||||
# https://github.com/containers/buildah/blob/master/docs/tutorials/05-openshift-rootless-bud.md
|
|
||||||
FROM quay.io/buildah/stable:v1.14.8
|
|
||||||
|
|
||||||
RUN touch /etc/subgid /etc/subuid \
|
RUN dnf -y install \
|
||||||
&& chmod g=u /etc/subgid /etc/subuid /etc/passwd \
|
make \
|
||||||
&& echo build:10000:65536 > /etc/subuid \
|
golang \
|
||||||
&& echo build:10000:65536 > /etc/subgid
|
bats \
|
||||||
|
btrfs-progs-devel \
|
||||||
|
device-mapper-devel \
|
||||||
|
glib2-devel \
|
||||||
|
gpgme-devel \
|
||||||
|
libassuan-devel \
|
||||||
|
libseccomp-devel \
|
||||||
|
git \
|
||||||
|
bzip2 \
|
||||||
|
go-md2man \
|
||||||
|
runc \
|
||||||
|
containers-common \
|
||||||
|
skopeo-containers
|
||||||
|
|
||||||
# Use chroot since the default runc does not work when running rootless
|
# Workaround - the first install somehow leaves the golang in a bad state
|
||||||
RUN echo "export BUILDAH_ISOLATION=chroot" >> /home/build/.bashrc
|
RUN dnf -y install golang
|
||||||
|
|
||||||
# Use VFS since fuse does not work
|
RUN mkdir /root/buildah && \
|
||||||
RUN mkdir -p /home/build/.config/containers \
|
cd /root/buildah && \
|
||||||
&& echo "driver=\"vfs\"" > /home/build/.config/containers/storage.conf
|
git clone https://github.com/harness/buildah.git ./src/github.com/containers/buildah
|
||||||
|
|
||||||
|
RUN cd /root/buildah/src/github.com/containers/buildah && make && sudo make install
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FROM quay.io/buildah/stable:v1.23.0
|
||||||
|
|
||||||
USER build
|
USER build
|
||||||
WORKDIR /home/build
|
WORKDIR /home/build
|
||||||
|
RUN export STORAGE_DRIVER=vfs
|
||||||
|
COPY --from=0 /root/buildah/src/github.com/containers/buildah/bin/. /bin/
|
||||||
|
|
||||||
# Add plugin binary
|
# Add plugin binary
|
||||||
|
ADD release/linux/amd64/drone-docker /bin/
|
||||||
ADD release/linux/amd64/drone-heroku /bin/
|
ADD release/linux/amd64/drone-heroku /bin/
|
||||||
ENTRYPOINT ["/bin/drone-heroku"]
|
ENTRYPOINT ["/bin/drone-heroku"]
|
||||||
|
|||||||
@ -10,9 +10,8 @@ set -e
|
|||||||
set -x
|
set -x
|
||||||
|
|
||||||
# linux
|
# linux
|
||||||
GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-gcr ./cmd/drone-gcr
|
# GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-gcr ./cmd/drone-gcr
|
||||||
GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-ecr ./cmd/drone-ecr
|
# GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-ecr ./cmd/drone-ecr
|
||||||
GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-docker ./cmd/drone-docker
|
GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-docker ./cmd/drone-docker
|
||||||
GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-acr ./cmd/drone-acr
|
# GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-acr ./cmd/drone-acr
|
||||||
GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-heroku ./cmd/drone-heroku
|
# GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/drone-heroku ./cmd/drone-heroku
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user