-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (45 loc) · 1.44 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# syntax=docker/dockerfile:1.2
#############################
# Builder for Linux
#############################
FROM golang:1.20 AS builder-linux
# Set environment variables for Linux
ENV GOARCH=amd64
ENV GOOS=linux
# Set the working directory
WORKDIR /app
# Copy the Go source code
COPY . .
# Build the Linux binary
RUN go build -o 3270Connect-linux go3270Connect.go
#############################
# Builder for Windows
#############################
FROM golang:1.20 AS builder-windows
# Set environment variables for Windows
ENV GOARCH=amd64
ENV GOOS=windows
# Set the working directory
WORKDIR /app
# Copy the Go source code
COPY . .
# Build the Windows binary
RUN go build -o 3270Connect.exe go3270Connect.go
#############################
# Final stage for Linux
#############################
FROM alpine:latest AS final-linux
# Copy the Linux binary from the builder
COPY --from=builder-linux /app/3270Connect-linux /usr/local/bin/3270Connect
# Make the binary executable
RUN chmod +x /usr/local/bin/3270Connect
# Define the entrypoint for the Linux container
ENTRYPOINT ["/usr/local/bin/3270Connect"]
#############################
# Final stage for Windows
#############################
FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS final-windows
# Copy the Windows binary from the builder
COPY --from=builder-windows /app/3270Connect.exe C:\3270Connect.exe
# Define the entrypoint for the Windows container
ENTRYPOINT ["C:\\3270Connect.exe"]