-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathDockerfile
51 lines (39 loc) · 1.1 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
FROM node:alpine AS frontend
WORKDIR /app
RUN apk --no-cache add make
COPY Makefile package.json package-lock.json ./
RUN make install-deps
COPY tailwind.config.js ./tailwind.config.js
COPY main.css ./main.css
COPY pkg ./pkg
COPY views ./views
COPY assets ./assets
RUN make build-dist build-tw
FROM golang:alpine AS backend
ARG BUILD_TIME
ARG GIT_COMMIT
ARG GIT_REF
ARG GIT_REF_NAME
ARG GIT_REF_TYPE
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY cmd ./cmd
COPY pkg ./pkg
COPY vendor ./vendor
COPY views ./views
COPY assets ./assets
COPY translations ./translations
COPY --from=frontend /app/assets/output.css ./assets/output.css
COPY --from=frontend /app/assets/dist ./assets/dist
ENV CGO_ENABLED=0
RUN go build \
-ldflags "-X 'main.buildTime=${BUILD_TIME}' -X 'main.gitCommit=${GIT_COMMIT}' -X 'main.gitRef=${GIT_REF}' -X 'main.gitRefName=${GIT_REF_NAME}' -X 'main.gitRefType=${GIT_REF_TYPE}'" \
-o /commands/ ./cmd/...
FROM alpine:latest
RUN apk add --no-cache tzdata
COPY --from=backend /commands/* /app/
VOLUME /data /imports
WORKDIR /data
ENTRYPOINT ["/app/workout-tracker"]
EXPOSE 8080