-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (22 loc) · 602 Bytes
/
Dockerfile
File metadata and controls
26 lines (22 loc) · 602 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Choose the golang image as the build base image
FROM golang:1.16-alpine AS build
# Define the directory we should work in
WORKDIR /app
# Download the necessary go modules
COPY go.mod go.sum ./
RUN go mod download
# Build the application
ARG PASTY_VERSION=unset-debug
COPY . .
RUN go build \
-o pasty \
-ldflags "\
-X github.com/lus/pasty/internal/static.Version=$PASTY_VERSION" \
./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/
EXPOSE 8080
CMD ["./pasty"]