masatrad commited on
Commit
a19ec9a
·
verified ·
1 Parent(s): 756bc55

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # syntax=docker/dockerfile:1
2
+
3
+ FROM golang:1.24
4
+
5
+ # Set destination for COPY
6
+ WORKDIR /app
7
+
8
+ # Copy the source code. Note the slash at the end, as explained in
9
+ # https://docs.docker.com/reference/dockerfile/#copy
10
+ COPY *.go ./
11
+
12
+ # Download Go modules
13
+ RUN go mod init masatrad.com/helloword
14
+ RUN go mod download
15
+
16
+ # Build
17
+ RUN CGO_ENABLED=0 GOOS=linux go build -o /helloworld
18
+
19
+ # Optional:
20
+ # To bind to a TCP port, runtime parameters must be supplied to the docker command.
21
+ # But we can document in the Dockerfile what ports
22
+ # the application is going to listen on by default.
23
+ # https://docs.docker.com/reference/dockerfile/#expose
24
+ EXPOSE 7860
25
+
26
+ # Run
27
+ CMD ["/helloworld"]