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 build #955

Merged
merged 8 commits into from Mar 18, 2023
Merged

Fix docker build #955

merged 8 commits into from Mar 18, 2023

Conversation

Askaholic
Copy link
Collaborator

@Askaholic Askaholic commented Mar 2, 2023

Seems like some change in setuptools broke our docker build, however, this really just exposed a bug in our build where the .git directory was not being copied to the docker context and therefore the git version tag couldn't be found from the setup.py file. I went ahead and rewrote the dockerfile to use a multi-stage approach so we should no longer have build tools like git and pipenv installed in the final container.

Closes #953

@Askaholic Askaholic force-pushed the fix-docker-build branch 2 times, most recently from c913cdf to 4321d78 Compare March 2, 2023 23:19
@Askaholic Askaholic force-pushed the fix-docker-build branch 2 times, most recently from af5b613 to 3e850b8 Compare March 4, 2023 16:45
Copy link
Member

@Brutus5000 Brutus5000 left a comment

Choose a reason for hiding this comment

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

I think you need to create the user earlier (or use an id) and chown on copy. This is an example from a quarkus skeleton app:

FROM registry.access.redhat.com/ubi8/openjdk-17:1.14

ENV LANGUAGE='en_US:en'


# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --chown=185 build/quarkus-app/lib/ /deployments/lib/
COPY --chown=185 build/quarkus-app/*.jar /deployments/
COPY --chown=185 build/quarkus-app/app/ /deployments/app/
COPY --chown=185 build/quarkus-app/quarkus/ /deployments/quarkus/

EXPOSE 8080
USER 185
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"


@Askaholic
Copy link
Collaborator Author

I don’t think so. The python files are just installed to the system anyway. The user isn’t needed at all during the build process, it just exists for the container to use at run time.

@Brutus5000
Copy link
Member

So "other" users have read/execute permissions on the code directory?

@Askaholic
Copy link
Collaborator Author

Yes, the code is installed as a python package with pip. Just like if you were to system install any other dependency with pip.

@Askaholic
Copy link
Collaborator Author

Tested on the test server and it still works with the existing configuration.

@Askaholic Askaholic merged commit 6bc37c4 into FAForever:develop Mar 18, 2023
@Askaholic Askaholic deleted the fix-docker-build branch March 18, 2023 01:40
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.

None yet

2 participants