-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support multi-stage builds for Management & Treatment Services Dockerfile #66
Support multi-stage builds for Management & Treatment Services Dockerfile #66
Conversation
Dockerfile
Outdated
@@ -21,6 +21,8 @@ RUN addgroup -S ${XP_USER_GROUP} \ | |||
|
|||
COPY --chown=${XP_USER}:${XP_USER_GROUP} management-service/bin/* /app/ | |||
COPY --chown=${XP_USER}:${XP_USER_GROUP} management-service/database /app/database/ | |||
# read+write access for owner/group but no write access for others | |||
RUN chmod -R 775 /app/xp-management |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Not sure if the chmod has some unintended impact. Are we still able to build and deploy the internal image on top of this? Can it be tested prior to merging this?
- Do we need a similar change for the treatment service too?
79d2521
to
798bbaf
Compare
4588c7d
to
ece9a9b
Compare
c2ed0cd
to
7ba76d5
Compare
621b653
to
c9f045f
Compare
7a0d786
to
3594e17
Compare
3594e17
to
0f327a4
Compare
eb8fd8b
to
2b6c32a
Compare
92227ed
to
e55a5ca
Compare
e55a5ca
to
2b80ed7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some small comments, the rest LGTM. Thanks @terryyylim !
Dockerfile
Outdated
@@ -19,8 +35,10 @@ RUN addgroup -S ${XP_USER_GROUP} \ | |||
&& mkdir /app \ | |||
&& chown -R ${XP_USER}:${XP_USER_GROUP} /app | |||
|
|||
COPY --chown=${XP_USER}:${XP_USER_GROUP} management-service/bin/* /app/ | |||
COPY --chown=${XP_USER}:${XP_USER_GROUP} management-service/database /app/database/ | |||
COPY --chown=${XP_USER}:${XP_USER_GROUP} management-service/bin/experiments.yaml /app/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can we do COPY --chown=${XP_USER}:${XP_USER_GROUP} management-service/bin/*.yaml /app/
instead of 2 separate commands to copy the OpenAPI specs?
@@ -34,7 +34,7 @@ lint: lint-python lint-go | |||
.PHONY: vendor | |||
vendor: | |||
@echo "Fetching dependencies..." | |||
go mod vendor | |||
cd management-service && go mod vendor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probabl also add commands to vendor the common
and clients
modules before vendoring the management service.
treatmentHistorySvc := services.NewTreatmentHistoryService(db) | ||
log.Println("Initializing treatment service...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These seem like Debug logs. It would be enough to just have error logs if the initialization fails. Alternatively, if we want to keep these logs, we should log them at the appropriate level.
What this PR does / why we need it:
When updating the helm chart for XP Management Service caraml-dev/helm-charts#220,
Permission Denied
error was faced when trying to run the generated binary.Subsequently, we're faced with
Exec format error
which points to our binary file being built on Ubuntu and to be used in an Alpine image. This PR adds multi-stage builds to build our app binaries using an Alpine image and copied over to the latest layer of our Docker image to solve the issue and also make the image leaner.Which issue(s) this PR fixes:
Fixes #