Skip to content

Commit

Permalink
Merge pull request #28 from stevenaldinger/bugfix/move-plugin-stuff-t…
Browse files Browse the repository at this point in the history
…o-public-package

make plugins code importable outside of decker
  • Loading branch information
stevenaldinger committed Mar 20, 2019
2 parents ae152de + fd4b5c1 commit 06c1e0f
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 18 deletions.
60 changes: 47 additions & 13 deletions build/package/minimal.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,54 @@
FROM golang:1.12.1 as builder

# install dep
ARG UNAME_S="Linux"
ARG GOARCH="amd64"
ARG TEMP_DL_DIR="/tmp/downloads"
ARG GOLANG_DL_BASE_URL="https://dl.google.com/go/go"
ARG GO_DEP_INSTALL_SCRIPT="https://raw.githubusercontent.com/golang/dep/master/install.sh"
ARG GO_DEP_RELEASE_TAG="v0.5.1"
ARG YOUR_GITHUB_HANDLE="stevenaldinger"
ARG APP_NAME="decker"

ENV \
DEP_RELEASE_TAG="${GO_DEP_RELEASE_TAG}" \
GOPATH="/go" \
GOBIN="/go/bin" \
GOARCH="amd64" \
PATH="$PATH:/go/bin"

# Install golang and dep
# Find versions and DL links here: https://golang.org/dl/
RUN apt-get update \
&& apt-get install -y \
ca-certificates \
&& curl https://raw.githubusercontent.com/golang/dep/master/install.sh \
--output /tmp/install-dep.sh \
--silent \
&& chmod a+x /tmp/install-dep.sh \
&& /tmp/install-dep.sh \
&& rm /tmp/install-dep.sh \
&& apt-get -y install \
build-essential \
ca-certificates \
curl \
git \
&& mkdir -p "${GOBIN}" "${TEMP_DL_DIR}" \
&& go version \
&& curl "${GO_DEP_INSTALL_SCRIPT}" \
--output "${TEMP_DL_DIR}/install-dep.sh" \
--silent \
&& chmod a+x "${TEMP_DL_DIR}/install-dep.sh" \
&& cat "${TEMP_DL_DIR}/install-dep.sh" \
&& "${TEMP_DL_DIR}/install-dep.sh" \
&& rm "${TEMP_DL_DIR}/install-dep.sh" \
&& go get -u golang.org/x/lint/golint \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* "${TEMP_DL_DIR}"

# # install dep
# RUN apt-get update \
# && apt-get install -y \
# ca-certificates \
# && curl https://raw.githubusercontent.com/golang/dep/master/install.sh \
# --output /tmp/install-dep.sh \
# --silent \
# && chmod a+x /tmp/install-dep.sh \
# && /tmp/install-dep.sh \
# && rm /tmp/install-dep.sh \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ARG APP_NAME=decker

Expand All @@ -25,9 +62,6 @@ RUN dep ensure -v \

FROM scratch as decker

# add decker to the path
ENV PATH="$PATH:/go/bin"

COPY --from=builder /go/src/github.com/stevenaldinger/decker/decker /go/bin/decker
COPY --from=builder /go/src/github.com/stevenaldinger/decker/internal/app/decker/plugins /go/bin/internal/app/decker/plugins
COPY --from=builder /go/src/github.com/stevenaldinger/decker/examples /go/bin/examples
Expand Down
4 changes: 2 additions & 2 deletions cmd/decker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"os"

"github.com/stevenaldinger/decker/internal/pkg/dependencies"
"github.com/stevenaldinger/decker/pkg/gocty"
"github.com/stevenaldinger/decker/internal/pkg/hcl"
"github.com/stevenaldinger/decker/internal/pkg/paths"
"github.com/stevenaldinger/decker/internal/pkg/plugins"
"github.com/stevenaldinger/decker/internal/pkg/reports"
"github.com/stevenaldinger/decker/pkg/gocty"
"github.com/stevenaldinger/decker/pkg/plugins"
)

// loop over list of strings and return true if list contains a given string
Expand Down
2 changes: 1 addition & 1 deletion internal/app/decker/plugins/outputs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"github.com/stevenaldinger/decker/internal/pkg/plugins"
"github.com/stevenaldinger/decker/pkg/plugins"
"github.com/zclconf/go-cty/cty"
ctyjson "github.com/zclconf/go-cty/cty/json"

Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/dependencies/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dependencies
import (
"fmt"
"github.com/hashicorp/hcl2/hcl"
"github.com/stevenaldinger/decker/internal/pkg/plugins"
"github.com/stevenaldinger/decker/pkg/plugins"
"os"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package plugins

import (
"fmt"
"github.com/stevenaldinger/decker/pkg/gocty"
"github.com/stevenaldinger/decker/internal/pkg/paths"
"github.com/stevenaldinger/decker/pkg/gocty"
"github.com/zclconf/go-cty/cty"
"os"
"plugin"
Expand Down

0 comments on commit 06c1e0f

Please sign in to comment.