diff --git a/Dockerfile b/Dockerfile index ef5f4d3..5fc605b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,25 @@ +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 . + FROM alpine LABEL version="1.4.0" -# Copy the distribution files -COPY ./dist /app +# 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 # Make /app the work directory WORKDIR /app