1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00
pasty/Dockerfile

26 lines
602 B
Docker
Raw Normal View History

2021-04-18 22:31:07 +03:00
# Choose the golang image as the build base image
2021-04-15 20:26:17 +03:00
FROM golang:1.16-alpine AS build
2021-04-18 22:31:07 +03:00
# Define the directory we should work in
2020-08-23 22:05:20 +03:00
WORKDIR /app
2021-04-18 22:31:07 +03:00
# Download the necessary go modules
2020-08-23 22:05:20 +03:00
COPY go.mod go.sum ./
RUN go mod download
2021-04-18 22:31:07 +03:00
# Build the application
ARG PASTY_VERSION=unset-debug
2020-08-23 22:05:20 +03:00
COPY . .
RUN go build \
-o pasty \
-ldflags "\
2021-04-18 22:31:07 +03:00
-X github.com/lus/pasty/internal/static.Version=$PASTY_VERSION" \
2020-08-23 22:05:20 +03:00
./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
2020-08-23 22:05:20 +03:00
CMD ["./pasty"]