-
Notifications
You must be signed in to change notification settings - Fork 1
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
dockerfile server #111
base: main
Are you sure you want to change the base?
dockerfile server #111
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM --platform=linux/amd64 alpine:latest | ||
|
||
# Update package list and install required certificates | ||
RUN apk --no-cache add ca-certificates \ | ||
&& apk add --no-cache libc6-compat | ||
|
||
# Set a working directory (optional) | ||
WORKDIR /app | ||
|
||
# Copy the local binary into the container | ||
COPY ./deweb-server_linux_amd64 /app/deweb-server_linux_amd64 | ||
|
||
# Give execution permissions to the binary | ||
RUN chmod +x /app/deweb-server_linux_amd64 | ||
|
||
# Expose the port on which the server listens (optional, if needed) | ||
EXPOSE 8080 | ||
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Users might want to use a specific DeWeb server configuration and so, use a different port, is that something that can be handled ? Or should users using docker change the exposed port another way than the DeWeb server config file ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's why docker is so cool. EXPOSE here say, IN the docker container we want to expose the port 8080 (because i know my software use this port), OTHER ports can't be acceded. user can choose to use any port on their host machine ( ex with -p option) ex user want to run deweb_server on port 5000 :
|
||
|
||
# Command to run the server | ||
CMD ["./deweb-server_linux_amd64"] |
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.
I'm unsure we should do that
IMO, we should divide this dockerfile into 2 stages, one to build and the other to run the image, so we don't require the host computer to have already built the binary
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.
Yes, that's a good solution; it's called a multi-stage build, which we discussed last week.
Another option is to place the binary directly into the image (as done here) and tag the image based on the binary (built by a CI or a third party).
Ex : deweb_server:1.0.0 contains the version 1.0.0 of deweb ... and user choose different version of the docker image based on the deweb server. (And pass a config file if needed).
But yeah let me work on multi stage build if u want