2022-06-01 21:24:03 +03:00
|
|
|
FROM golang:1.18 as builder
|
|
|
|
|
|
|
|
# Go into the app dir
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Copy all of the source to /app
|
|
|
|
COPY . ./
|
|
|
|
|
|
|
|
# Download dependencies
|
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
# Build
|
|
|
|
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o freepad .
|
|
|
|
|
2022-05-21 16:45:56 +03:00
|
|
|
FROM alpine
|
|
|
|
|
2022-06-01 18:29:17 +03:00
|
|
|
LABEL version="1.4.0"
|
2022-05-21 16:45:56 +03:00
|
|
|
|
2022-06-01 21:24:03 +03:00
|
|
|
# Copy the files from the builder to the new image
|
|
|
|
COPY --from=builder /app/freepad /app/freepad
|
|
|
|
COPY --from=builder /app/templates /app/templates
|
|
|
|
COPY --from=builder /app/static /app/static
|
2022-05-21 16:45:56 +03:00
|
|
|
|
|
|
|
# Make /app the work directory
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Expose the listening port
|
|
|
|
EXPOSE 8080
|
|
|
|
|
|
|
|
# Run the program
|
|
|
|
ENTRYPOINT ["./freepad"]
|