Files
Matthias Hinrichs 43f5893972
Build Docker Container using Multistage Build / build (push) Has been cancelled
updated Dockerfile base images
2026-02-18 01:20:05 +01:00

43 lines
822 B
Docker

# Stage 1: Golang-Basisimage zum Bauen der App
FROM golang:latest as build-stage
RUN go version
WORKDIR /app
COPY . .
RUN ls -lha
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o manage-servers .
RUN ls -lha
# Stage 2: Nginx zum Ausführen der App
FROM alpine:latest as production-stage
# Create application directory
RUN mkdir -p /app/config
# Set working directory
WORKDIR /app/
# Copy the compiled binary from the builder stage
COPY --from=build-stage /app/manage-servers .
# Copy the index.html file for the web server
COPY --from=build-stage /app/index.html .
RUN ls -la /app/
# Make the binary executable
#RUN chmod +x ./manage-servers
# Expose the port the web server listens on
EXPOSE 8080
# Command to run the application
ENTRYPOINT ["./manage-servers", "serve"]