1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00
pasty/Dockerfile
Baalaji befc9615d5
docker: Expose 8080 from dockerfile (#30)
This helps service discovery on traefik, which uses the exposed port to determine where to reverse proxy to

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2021-12-19 13:24:53 +01:00

26 lines
602 B
Docker

# 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"]