Skip to content

Commit

Permalink
Remove docker commands (#75)
Browse files Browse the repository at this point in the history
Simplifies things down to their core.
  • Loading branch information
CGA1123 authored Dec 1, 2021
1 parent 5f4090f commit a43051c
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 467 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,5 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/build-push-action@v2
with:
context: .
tags: ghcr.io/cga1123/slugcmplr:testing
load: true
build-args: STACK=20
- run: go get -v -d ./...
- run: go test -v -race -parallel=4 ./...
8 changes: 0 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/build-push-action@v2
with:
context: .
tags: ghcr.io/cga1123/slugcmplr:testing
load: true
build-args: STACK=20
- run: go get -v -d ./...
- run: bin/go-post-compile
- run: script/migrate up
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,6 @@ on:
- '*'

jobs:
containers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
stack: [ '18', '20' ]

steps:
- uses: actions/[email protected]
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: docker build
run: |
docker build \
--build-arg STACK=${{ matrix.stack }} \
--tag ghcr.io/cga1123/slugcmplr:heroku-${{ matrix.stack }} \
--tag ghcr.io/cga1123/slugcmplr:heroku-${{ matrix.stack }}-${{ github.sha }} \
.
- run: docker push ghcr.io/cga1123/slugcmplr:heroku-${{ matrix.stack }}
- run: docker push ghcr.io/cga1123/slugcmplr:heroku-${{ matrix.stack }}-${{ github.sha }}

goreleaser:
runs-on: ubuntu-latest
steps:
Expand Down
19 changes: 0 additions & 19 deletions Dockerfile

This file was deleted.

25 changes: 0 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@ uploaded to Heroku.
The `CACHE-DIR` will be used by the buildpacks as their cache argument to speed
up builds in the future, as per the [Buildpack API](https://devcenter.heroku.com/articles/buildpack-api)

You can optionally pass `--local` to run the compile steps locally, outside of
any docker image.

You can optionally pass `--image [IMAGE]` to use a custom docker image,
`slugcmplr` assumes that a version of itself is available at `bin/slugcmplr` in
the image. You can use the `%stack%` pattern in `IMAGE` to have the stack (e.g.
`heroku-20`) a part of the image name.


#### `release --build-dir [BUILD-DIR]`

In the release step, `slugcmplr` triggers a release of your previously compiled
Expand All @@ -87,22 +78,6 @@ different from the one you build from. This will work as long as the
applications are in the same Heroku team. (This is becuase the slug must be
accessible to the application).

#### `image --build-dir [BUILD-DIR] --cmd [CMD]`

The `image` subcommand builds a container image using `docker build`. By
default it uses a Heroku Stack Image (e.g. `heroku/heroku:20`) that is
compatible with your application.

You can optionally pass `--image [IMAGE]` to use a custom base image. You can
use the `%stack%` pattern in `IMAGE` to have a stack _number_ (e.g. `20`) as
part of the image name or tag.

The image is build by copying the contents of your application after building
into `/app`.

The `CMD` is the command that Heroku will use in its container runtime to start
your application. (e.g. `bundle exec puma -p $PORT`, `bin/server --port $PORT`).

## Authentication

The `slugcmplr` CLI looks for credentials to `api.heroku.com` in your `.netrc`
Expand Down
38 changes: 4 additions & 34 deletions cmd/slugcmplr/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
"github.com/spf13/cobra"
)

const defaultImage = "ghcr.io/cga1123/slugcmplr:" + slugcmplr.StackReplacePattern

// Compile contains the configuration required for the compile subcommand.
type Compile struct {
Application string `json:"application"`
Expand Down Expand Up @@ -82,8 +80,7 @@ func compile(ctx context.Context, out outputter, h *heroku.Service, c *Compile,
}

func compileCmd(verbose bool) *cobra.Command {
var cacheDir, buildDir, image string
var local bool
var cacheDir, buildDir string

cmd := &cobra.Command{
Use: "compile",
Expand Down Expand Up @@ -118,46 +115,19 @@ func compileCmd(verbose bool) *cobra.Command {
return fmt.Errorf("failed to decode metadata: %w", err)
}

if local {
client, err := netrcClient(output)
if err != nil {
return err
}

return compile(cmd.Context(), output, client, c, buildDir, cacheDir)
}

netrcpath, err := netrcPath()
client, err := netrcClient(output)
if err != nil {
return fmt.Errorf("failed to find netrc path: %w", err)
}

compileDocker := &slugcmplr.CompileDockerCmd{
BuildDir: buildDir,
CacheDir: cacheDir,
NetrcPath: netrcpath,
Image: image,
Stack: c.Stack,
return err
}

return compileDocker.Execute(cmd.Context(), output)
return compile(cmd.Context(), output, client, c, buildDir, cacheDir)
},
}

cmd.Flags().StringVar(&buildDir, "build-dir", "", "The build directory")
cmd.MarkFlagRequired("build-dir") // nolint:errcheck

cmd.Flags().BoolVar(&local, "local", false, "Run compilation locally")
cmd.Flags().StringVar(&cacheDir, "cache-dir", "", "The cache directory")
cmd.Flags().StringVar(
&image,
"image",
defaultImage,
fmt.Sprintf(
"Override docker image to use, include %s in order to substitute the stack name",
slugcmplr.StackReplacePattern,
),
)

return cmd
}
111 changes: 0 additions & 111 deletions cmd/slugcmplr/image.go

This file was deleted.

1 change: 0 additions & 1 deletion cmd/slugcmplr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func Cmd() *cobra.Command {
prepareCmd,
compileCmd,
releaseCmd,
imageCmd,
versionCmd,
serverCmd,
workerCmd,
Expand Down
Loading

0 comments on commit a43051c

Please sign in to comment.