Skip to content

Commit

Permalink
clean up CMDs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys committed Aug 11, 2023
1 parent 1eb1230 commit 9f0010b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ export class GDF {

// command to start the web server
get startCommand() {
if (this.options.cmd) return JSON.stringify(this.options.cmd)
if (this.options.cmd) return this.options.cmd

if (this.options.distroless) {
const start = this.#pj.scripts.start
Expand Down
4 changes: 3 additions & 1 deletion templates/Dockerfile.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ EXPOSE <%= port %>
<% } -%>
<% if (foreman) { -%>
CMD [ "<%= packager === "bun" ? 'bunx' : 'npx' %>", "foreman", "start", "--procfile", "Procfile.prod" ]
<% } else { -%>
<% } else if (Array.isArray(startCommand)) { -%>
CMD <%- JSON.stringify(startCommand, null, 1).replaceAll(/\n\s*/g, " ") %>
<% } else { -%>
CMD <%- startCommand %>
<% } -%>
2 changes: 1 addition & 1 deletion test/base/cmd-entrypoint/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ ENTRYPOINT "node"

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD "\"./bin/www\""
CMD ./bin/www

0 comments on commit 9f0010b

Please sign in to comment.