treasurer/Dockerfile

30 lines
567 B
Docker
Raw Normal View History

2023-06-13 13:22:51 +00:00
# BUILD
FROM golang:1.20.3-alpine AS build
# Update depences
RUN apk update && apk add --no-cache curl
# Create build directory
RUN mkdir /app/bin -p
# Set home directory
WORKDIR /app
# Copy go.mod
ADD go.mod go.sum /app/
# Download go depences
RUN go mod download
# Copy all local files
ADD . /app
# Build app
RUN GOOS=linux go build -o bin ./...
# PRODUCTION
FROM alpine:latest AS production
# Install packages
RUN apk --no-cache add ca-certificates
# Create home directory
WORKDIR /app
# Copy build file
COPY --from=build /app/bin/app ./app
# CMD
CMD ["./app"]