-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
53 lines (35 loc) · 1.08 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# build web
FROM node:18.7.0-alpine3.16 AS web-builder
WORKDIR /web
COPY web/package.json web/pnpm-lock.yaml ./
# install pnpm
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile --prod
COPY web/ .
RUN pnpm run build
# build app
FROM golang:1.20-alpine3.16 AS app-builder
ARG VERSION=dev
ARG REVISION=dev
ARG BUILDTIME
RUN apk add --no-cache git make build-base tzdata
ENV SERVICE=syncyomi
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
COPY --from=web-builder /web/dist ./web/dist
COPY --from=web-builder /web/build.go ./web
RUN go build -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${REVISION} -X main.date=${BUILDTIME}" -o bin/syncyomi main.go
# build final image
FROM alpine:latest
LABEL org.opencontainers.image.source = "https://github/SyncYomi/SyncYomi"
ENV HOME="/config" \
XDG_CONFIG_HOME="/config" \
XDG_DATA_HOME="/config"
RUN apk add --no-cache ca-certificates curl tzdata jq
WORKDIR /app
VOLUME /config
COPY --from=app-builder /src/bin/syncyomi /usr/local/bin/
EXPOSE 8282
ENTRYPOINT ["/usr/local/bin/syncyomi", "--config", "/config"]