Skip to content

Commit

Permalink
refactor(support): update docker related path to be the root folder (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cayter authored Jun 29, 2020
1 parent 55154e3 commit f3543ec
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ An opinionated productive web framework that helps scaling business easier, i.e.
db:schema:load Load all the databases schema for the current environment
db:seed Seed all databases for the current environment
dc:down Tear down the docker compose cluster
dc:restart Restart services that are defined in `.docker/docker-compose.yml`
dc:up Create and start containers that are defined in `.docker/docker-compose.yml`
dc:restart Restart services that are defined in `docker-compose.yml`
dc:up Create and start containers that are defined in `docker-compose.yml`
gen:migration Generate database migration file(default: primary, use --database to specify the target database) for the current environment (only available in debug build)
help Help about any command
middleware List all the global middleware
Expand Down
2 changes: 1 addition & 1 deletion cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func buildWebApp(logger *support.Logger, server *pack.Server, wd string) error {

func copyAssetsFolder(asset *support.Asset, logger *support.Logger, releasePath string) error {
logger.Infof("Copying server-side assets into '%s' folder...", releasePath)
toCopies := []string{asset.Layout().Config(), asset.Layout().Docker(), asset.Layout().Locale(), asset.Layout().View()}
toCopies := []string{asset.Layout().Config(), asset.Layout().Root() + "/docker-compose.yml", asset.Layout().Locale(), asset.Layout().View()}

for _, toCopy := range toCopies {
err := copy.Copy(toCopy, releasePath+"/"+toCopy)
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func runDockerCompose(action string, asset *support.Asset) error {
data []byte
err error
)
dcPath := asset.Layout().Docker() + "/docker-compose.yml"
dcPath := asset.Layout().Root() + "/docker-compose.yml"

if support.IsDebugBuild() {
data, err = ioutil.ReadFile(dcPath)
Expand Down
2 changes: 1 addition & 1 deletion cmd/dcrestart.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/appist/appy/support"
func newDcRestartCommand(asset *support.Asset, logger *support.Logger) *Command {
return &Command{
Use: "dc:restart",
Short: "Restart services that are defined in `.docker/docker-compose.yml`",
Short: "Restart services that are defined in `docker-compose.yml`",
Run: func(cmd *Command, args []string) {
err := checkDocker()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dcup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/appist/appy/support"
func newDcUpCommand(asset *support.Asset, logger *support.Logger) *Command {
return &Command{
Use: "dc:up",
Short: "Create and start containers that are defined in `.docker/docker-compose.yml`",
Short: "Create and start containers that are defined in `docker-compose.yml`",
Run: func(cmd *Command, args []string) {
err := checkDocker()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pack/mdwspa.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func mdwSPA(server *Server, prefix string, fs http.FileSystem) HandlerFunc {

if !server.isCSRPath(req.URL.Path) ||
strings.HasPrefix(req.URL.Path, "/"+server.asset.Layout().Config()) ||
strings.HasPrefix(req.URL.Path, "/"+server.asset.Layout().Docker()) ||
strings.HasPrefix(req.URL.Path, "/docker-compose.yml") ||
strings.HasPrefix(req.URL.Path, "/"+server.asset.Layout().Locale()) ||
strings.HasPrefix(req.URL.Path, "/"+server.asset.Layout().View()) {
c.Next()
Expand Down
2 changes: 1 addition & 1 deletion pack/mdwspa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (s *mdwSPASuite) TestSSROrReservedPath() {
urls := []string{
"/ssr",
"/" + s.asset.Layout().Config(),
"/" + s.asset.Layout().Docker(),
"/docker-compose.yml",
"/" + s.asset.Layout().Locale(),
"/" + s.asset.Layout().View(),
}
Expand Down
6 changes: 0 additions & 6 deletions support/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func NewAsset(embedded http.FileSystem, root string) *Asset {
embedded: embedded,
layout: &AssetLayout{
config: "configs",
docker: ".docker",
locale: "pkg/locales",
root: root,
view: "pkg/views",
Expand Down Expand Up @@ -111,11 +110,6 @@ func (l *AssetLayout) Config() string {
return l.config
}

// Docker returns the path that stores the docker related files.
func (l *AssetLayout) Docker() string {
return l.docker
}

// Locale returns the path that stores the server-side rendering locales.
func (l *AssetLayout) Locale() string {
return l.locale
Expand Down
1 change: 0 additions & 1 deletion support/asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func (s *assetSuite) TestAssetLayout() {
asset := NewAsset(nil, "")

s.Equal("configs", asset.Layout().Config())
s.Equal(".docker", asset.Layout().Docker())
s.Equal("pkg/locales", asset.Layout().Locale())
s.Equal("", asset.Layout().Root())
s.Equal("pkg/views", asset.Layout().View())
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion support/templates/scaffold/Makefile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ clean:
rm -rf dist coverage.out {{.projectName}} **/*.log

docker\:build:
DOCKER_BUILDKIT=1 docker build -f .docker/Dockerfile --rm .
DOCKER_BUILDKIT=1 docker build --rm .

codecheck:
go vet ./...
Expand Down

0 comments on commit f3543ec

Please sign in to comment.