mirror of https://github.com/JustKato/FreePad.git
Merge pull request #13 from JustKato/feature/dockerFileBuild
Dockerfile Build Improvements
This commit is contained in:
commit
662dad90b7
24
Dockerfile
24
Dockerfile
|
@ -1,9 +1,27 @@
|
|||
FROM alpine
|
||||
# Importing golang 1.18 to use as a builder for our source
|
||||
FROM golang:1.18 as builder
|
||||
|
||||
# Use the /src directory as a workdir
|
||||
WORKDIR /src
|
||||
|
||||
# Copy the src to /src
|
||||
COPY . ./
|
||||
|
||||
# Download dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Build the executable
|
||||
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o freepad .
|
||||
|
||||
# Import alpine linux as a base
|
||||
FROM scratch
|
||||
|
||||
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 /src/freepad /app/freepad
|
||||
COPY --from=builder /src/templates /app/templates
|
||||
COPY --from=builder /src/static /app/static
|
||||
|
||||
# Make /app the work directory
|
||||
WORKDIR /app
|
||||
|
|
Loading…
Reference in New Issue