mirror of
https://github.com/lus/pasty.git
synced 2023-08-10 21:13:09 +03:00
Dockerize the application
This commit is contained in:
parent
bb196a1c6a
commit
d70251a4fb
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@ -0,0 +1,20 @@
|
||||
# Build the application
|
||||
FROM golang:1.15-alpine AS build
|
||||
RUN apk update && apk upgrade && \
|
||||
apk add --no-cache bash git openssh
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN go build \
|
||||
-o pasty \
|
||||
-ldflags "\
|
||||
-X github.com/Lukaesebrot/pasty/internal/static.Version=$(git rev-parse --abbrev-ref HEAD)-$(git describe --tags --abbrev=0)-$(git log --pretty=format:'%h' -n 1)" \
|
||||
./cmd/pasty/main.go
|
||||
|
||||
# Run the application in an empty alpine environment
|
||||
FROM alpine:latest
|
||||
WORKDIR /root
|
||||
COPY --from=build /app/pasty .
|
||||
COPY web ./web/
|
||||
CMD ["./pasty"]
|
Loading…
Reference in New Issue
Block a user