Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker buildfile #685

Merged
merged 1 commit into from
Sep 6, 2020
Merged

Fix docker buildfile #685

merged 1 commit into from
Sep 6, 2020

Conversation

cflipse
Copy link
Contributor

@cflipse cflipse commented Sep 6, 2020

Was resulting in an error when attempting to run the build:
app_1 | /usr/local/bundle/gems/thor-1.0.1/lib/thor/parser/arguments.rb:133:in `parse_numeric': Expected numeric value for '--port'; got "${APP_PORT}" (Thor::MalformattedArgumentError)

There are two things that aren't quite set up right here:

The build arg was not in scope -- used args need to be below the
FROM statement to be accessible.

CMD appears to not allow variable expansion, because it is processed at
runtime rather than build time. Instead, we can export the PORT
envar, which will be picked up by config/puma.rb when starting rails.

Was resulting in an error when attempting to run the build:
  app_1    | /usr/local/bundle/gems/thor-1.0.1/lib/thor/parser/arguments.rb:133:in `parse_numeric': Expected numeric value for '--port'; got "${APP_PORT}" (Thor::MalformattedArgumentError)

There are two things that aren't quite set up right here:

The build arg was not in scope -- used args need to be _below_ the
`FROM` statement to be accessible.

CMD appears to not allow variable expansion, because it is processed at
runtime rather than build time.  Instead, we can export the `PORT`
envar, which will be picked up by `config/puma.rb` when starting rails.
Copy link
Contributor

@grenewode grenewode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good! We should think about if there's a way to run ci tests on these so we avoid these kinds of breakages in the future!

@cflipse cflipse merged commit b8ff396 into main Sep 6, 2020
@solebared solebared deleted the fix-docker-port branch October 13, 2020 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants