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

dockerfile server #111

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions server/Dockerfile
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
Copy link
Member

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

Copy link
Member Author

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


# 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
Copy link
Member

Choose a reason for hiding this comment

The 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 ?

Copy link
Member Author

Choose a reason for hiding this comment

The 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 :

docker run -p 5000:8080 deweb_server


# Command to run the server
CMD ["./deweb-server_linux_amd64"]
Loading