Skip to content

Commit 710f60e

Browse files
authored
Switch to goreleaser-xx (#2)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
1 parent 13750c3 commit 710f60e

File tree

7 files changed

+25
-188
lines changed

7 files changed

+25
-188
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/dist
1+
/dist

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
/dist
2-
/.goreleaser.yml

Dockerfile

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
# syntax=docker/dockerfile:1.2
22
ARG GO_VERSION=1.14
3-
ARG GORELEASER_VERSION=0.157.0
43

4+
FROM --platform=$BUILDPLATFORM crazymax/goreleaser-xx:latest AS goreleaser-xx
55
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
6-
ARG GORELEASER_VERSION
7-
RUN apk add --no-cache ca-certificates curl gcc file git linux-headers musl-dev tar
8-
RUN wget -qO- https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_Linux_x86_64.tar.gz | tar -zxvf - goreleaser \
9-
&& mv goreleaser /usr/local/bin/goreleaser
6+
COPY --from=goreleaser-xx / /
7+
RUN apk add --no-cache ca-certificates curl file gcc git linux-headers musl-dev tar
108
WORKDIR /src
119

12-
FROM base AS gomod
13-
RUN --mount=type=bind,target=.,rw \
14-
--mount=type=cache,target=/go/pkg/mod \
15-
go mod tidy && go mod download
16-
17-
FROM gomod AS build
10+
FROM base AS build
1811
ARG TARGETPLATFORM
19-
ARG TARGETOS
20-
ARG TARGETARCH
21-
ARG TARGETVARIANT
2212
ARG GIT_REF
2313
RUN --mount=type=bind,target=/src,rw \
2414
--mount=type=cache,target=/root/.cache/go-build \
2515
--mount=target=/go/pkg/mod,type=cache \
26-
./hack/goreleaser.sh "yasu" "/out"
16+
goreleaser-xx --debug \
17+
--name "yasu" \
18+
--dist "/out" \
19+
--hooks="go mod tidy" \
20+
--hooks="go mod download" \
21+
--ldflags="-s -w -X 'main.Version={{.Version}}'" \
22+
--files="CHANGELOG.md" \
23+
--files="LICENSE" \
24+
--files="README.md"
2725

2826
FROM scratch AS artifacts
2927
COPY --from=build /out/*.tar.gz /

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ ___
99

1010
* [Yet Another?](#yet-another)
1111
* [About](#about)
12-
* [Warning](#warning)
13-
* [Installation](#installation)
12+
* [Warning](#warning)
13+
* [Usage](#usage)
1414
* [From binary](#from-binary)
1515
* [From Dockerfile](#from-dockerfile)
1616
* [Build](#build)
@@ -22,7 +22,7 @@ ___
2222
* [Others](#others)
2323
* [License](#license)
2424

25-
# Yet Another?
25+
## Yet Another?
2626

2727
This repository is a fork of [tianon/gosu](https://github.com/tianon/gosu) and renamed to avoid confusion as asked by
2828
the main maintainer. See [tianon/gosu#82 (comment)](https://github.com/tianon/gosu/pull/82#issuecomment-790874961).
@@ -34,7 +34,7 @@ added to avoid tempered artifacts and more transparency around [releases](https:
3434

3535
More info: [tianon/gosu#82](https://github.com/tianon/gosu/pull/82)
3636

37-
# About
37+
## About
3838

3939
This is a simple tool grown out of the simple fact that `su` and `sudo` have very strange and often annoying TTY and
4040
signal-forwarding behavior. They're also somewhat complex to setup and use (especially in the case of `sudo`), which
@@ -58,7 +58,7 @@ Once the user/group is processed, we switch to that user, then we `exec` the spe
5858
longer resident or involved in the process lifecycle at all. This avoids all the issues of signal passing and TTY,
5959
and punts them to the process invoking `yasu` and the process being invoked by `yasu`, where they belong.
6060

61-
## Warning
61+
### Warning
6262

6363
The core use case for `yasu` is to step _down_ from `root` to a non-privileged user during container startup
6464
(specifically in the `ENTRYPOINT`, usually).
@@ -67,7 +67,7 @@ Uses of `yasu` beyond that could very well suffer from vulnerabilities such as C
6767
use case naturally shields us); see [`tianon/gosu#37`](https://github.com/tianon/gosu/issues/37) for some discussion
6868
around this point.
6969

70-
## Installation
70+
## Usage
7171

7272
### From binary
7373

@@ -77,6 +77,8 @@ Choose the archive matching the destination platform:
7777

7878
```shell
7979
wget -qO- https://github.com/crazy-max/yasu/releases/download/v1.13.0/yasu_1.13.0_linux_x86_64.tar.gz | tar -zxvf - yasu
80+
yasu --version
81+
yasu nobody true
8082
```
8183

8284
### From Dockerfile
@@ -105,9 +107,7 @@ Image: crazymax/alpine-s6:latest
105107
Here is how to use `yasu` inside your Dockerfile:
106108

107109
```Dockerfile
108-
ARG YASU_VERSION=1.13.0
109-
110-
FROM crazymax/yasu:${YASU_VERSION} AS yasu
110+
FROM crazymax/yasu:latest AS yasu
111111
FROM alpine
112112
COPY --from=yasu / /
113113
RUN yasu --version
@@ -116,8 +116,6 @@ RUN yasu nobody true
116116

117117
## Build
118118

119-
You only need Docker to build `yasu`:
120-
121119
```shell
122120
git clone https://github.com/crazy-max/yasu.git yasu
123121
cd yasu

docker-bake.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ target "image-all" {
104104
inherits = ["image"]
105105
platforms = [
106106
"linux/amd64",
107+
"linux/arm/v5",
107108
"linux/arm/v6",
108109
"linux/arm/v7",
109110
"linux/arm64",

hack/goreleaser.sh

Lines changed: 0 additions & 160 deletions
This file was deleted.

version.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
package main
22

3+
// Version is the app version
34
var Version = "dev"

0 commit comments

Comments
 (0)