-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# Build the Linux image | ||
docker build --target final-linux -t 3270connect-linux . | ||
|
||
# Build the Windows image | ||
docker build --target final-windows -t 3270connect-windows . |