This repository has been archived on 2026-01-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
cover-letter-templater/Dockerfile.backend

43 lines
819 B
Docker
Raw Permalink Normal View History

FROM golang:1.24.4-alpine3.22@sha256:68932fa6d4d4059845c8f40ad7e654e626f3ebd3706eef7846f319293ab5cb7a AS base
2025-07-03 15:04:27 +03:00
# Set up workdir
WORKDIR /app
# Install dependencies
COPY go.mod go.sum ./
2025-07-03 15:04:27 +03:00
RUN go mod download
2025-07-13 20:44:13 +03:00
# ---- Build mode ----
FROM base AS build
WORKDIR /app
2025-07-05 21:11:09 +03:00
2025-07-03 15:04:27 +03:00
# Copy code, and compile
COPY . .
RUN go build -o server main.go
2025-07-13 20:44:13 +03:00
# ---- Production mode ----
FROM alpine@sha256:8a1f59ffb675680d47db6337b49d22281a139e9d709335b492be023728e11715 AS prod
WORKDIR /app
# Copy built binary
COPY --from=build /app/server .
2025-07-03 15:04:27 +03:00
# Expose 8080 port
EXPOSE 8080
# Run server binary on start
CMD ["./server"]
2025-07-05 21:11:09 +03:00
# ---- Development mode ----
FROM base AS dev
# Install air for hot reloading
RUN go install github.com/air-verse/air@latest
2025-07-05 21:22:18 +03:00
# Copy code, and expose port
COPY . .
EXPOSE 8080
2025-07-05 21:11:09 +03:00
2025-07-05 21:22:18 +03:00
# Enable hot reloading for go
CMD [ "air" ]