-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (26 loc) · 958 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# syntax=docker/dockerfile:1
FROM golang:latest AS build-binary
WORKDIR "/go/src/github.com/lukasbischof/luk4s.dev/"
COPY ["go.mod", "go.sum", "*.go", "./"]
RUN go mod download && go mod verify
COPY app ./app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -v -o /go/bin/luk4s.dev .
FROM oven/bun:1 AS build-assets
WORKDIR /usr/src/app
COPY assets/ ./assets
COPY bin/ ./bin
COPY public/ ./public
COPY ["package.json", "bun.lockb", "./"]
RUN bun install --frozen-lockfile --production
RUN bun run build
FROM alpine:3.18.0
LABEL org.opencontainers.image.authors="Lukas Bischof <[email protected]>"
LABEL org.opencontainers.image.url="https://github.com/lukasbischof/luk4s.dev"
RUN apk --no-cache add ca-certificates
WORKDIR /opt/luk4s.dev
COPY --from=build-binary /go/bin/luk4s.dev ./
COPY --from=build-assets /usr/src/app/public ./public
COPY "schema.sql" "./"
COPY "views/" "./views"
EXPOSE 3000
CMD ["sh", "-c", "/opt/luk4s.dev/luk4s.dev"]