Hello, how can i deploy my golang server(backend).
Each time i tried to deploy i got an error :
023-01-21T14:04:26.093 app[906d968c] fra [info] Preparing to run: `./main` as root
2023-01-21T14:04:26.097 app[906d968c] fra [info] Error: UnhandledIoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2023-01-21T14:04:26.098 app[906d968c] fra [info] [ 0.080852] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
2023-01-21T14:04:26.098 app[906d968c] fra [info] [ 0.081953] CPU: 0 PID: 1 Comm: init Not tainted 5.12.2 #1
2023-01-21T14:04:26.099 app[906d968c] fra [info] [ 0.082732] Call Trace:
2023-01-21T14:04:26.099 app[906d968c] fra [info] [ 0.083089] show_stack+0x52/0x58
2023-01-21T14:04:26.100 app[906d968c] fra [info] [ 0.083562] dump_stack+0x6b/0x86
2023-01-21T14:04:26.100 app[906d968c] fra [info] [ 0.083912] panic+0xfb/0x2bc
2023-01-21T14:04:26.100 app[906d968c] fra [info] [ 0.084226] do_exit.cold+0x60/0xb0
2023-01-21T14:04:26.101 app[906d968c] fra [info] [ 0.084644] do_group_exit+0x3b/0xb0
2023-01-21T14:04:26.101 app[906d968c] fra [info] [ 0.085172] __x64_sys_exit_group+0x18/0x20
2023-01-21T14:04:26.102 app[906d968c] fra [info] [ 0.085749] do_syscall_64+0x38/0x50
2023-01-21T14:04:26.103 app[906d968c] fra [info] [ 0.086241] entry_SYSCALL_64_after_hwframe+0x44/0xae
2023-01-21T14:04:26.103 app[906d968c] fra [info] [ 0.086921] RIP: 0033:0x7f1e9ef2c1a9
2023-01-21T14:04:26.106 app[906d968c] fra [info] [ 0.087447] Code: eb ef 48 8b 76 28 e9 a5 03 00 00 64 48 8b 04 25 00 00 00 00 48 8b b0 b0 00 00 00 e9 af ff ff ff 48 63 ff b8 e7 00 00 00 0f 05 <ba> 3c 00 00 00 48 89 d0 0f 05 eb f9 66 2e 0f 1f 84 00 00 00 00 00
2023-01-21T14:04:26.107 app[906d968c] fra [info] [ 0.090076] RSP: 002b:00007ffe25ef0b28 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
2023-01-21T14:04:26.108 app[906d968c] fra [info] [ 0.091135] RAX: ffffffffffffffda RBX: 00007f1e9eca9050 RCX: 00007f1e9ef2c1a9
2023-01-21T14:04:26.109 app[906d968c] fra [info] [ 0.092144] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
2023-01-21T14:04:26.110 app[906d968c] fra [info] [ 0.093148] RBP: 0000000000000001 R08: 00007f1e9f005b08 R09: 0000000000000000
2023-01-21T14:04:26.111 app[906d968c] fra [info] [ 0.094153] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe25ef0b88
2023-01-21T14:04:26.112 app[906d968c] fra [info] [ 0.095169] R13: 00007ffe25ef0b98 R14: 0000000000000000 R15: 0000000000000000
2023-01-21T14:04:26.112 app[906d968c] fra [info] [ 0.096158] Kernel Offset: disabled
2023-01-21T14:04:26.113 app[906d968c] fra [info] [ 0.096674] Rebooting in 1 seconds..
The docker file is shown below
# First stage: Build the binary
FROM golang:latest AS build
# Set the working directory in the container
WORKDIR /app
# Copy the go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy the source code to the container
COPY . .
# Build the binary
RUN go build -o main .
# Second stage: Copy the binary to a minimal image
FROM alpine:latest
# Set the working directory
WORKDIR /root/
# Copy the binary from the build stage
COPY --from=build /app/main .
# Expose the port that the application will run on
EXPOSE 9090
# Run the binary
CMD ["./main"]
Thanks for your help