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

27 lines
632 B
Docker
Raw Permalink 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 . .
ENV CGO_ENABLED=0
2020-08-23 22:05:20 +03:00
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 on distroless
FROM gcr.io/distroless/base:latest
2020-08-23 22:05:20 +03:00
WORKDIR /root
COPY --from=build /app/pasty .
2023-06-08 20:17:34 +03:00
COPY internal/web/web ./web/
EXPOSE 8080
2020-08-23 22:05:20 +03:00
CMD ["./pasty"]