forked from pluja/blogo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (35 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
45 lines (35 loc) · 1.01 KB
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
# Builder stage
FROM devopsworks/golang-upx:1.20 as builder
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /app
COPY blogo .
RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o blogo . && \
upx blogo
RUN chmod a+rx blogo
RUN mkdir -p /app/articles/
# Node stage
FROM node:alpine AS node
WORKDIR /app
COPY ./tailwind.config.js .
COPY ./package.json .
COPY ./package-lock.json .
COPY ./static ./static
COPY ./templates ./templates
RUN npm install && \
npx tailwindcss -i ./static/css/input.css -o ./static/css/style.css --minify
# Start from a complete image
FROM alpine:latest as certs
RUN apk --update add ca-certificates
# Final stage
FROM scratch
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
WORKDIR /app
COPY --from=builder /app/blogo /app/blogo
COPY --from=builder /app/articles /app/articles
# Copy HTML files
COPY templates templates
COPY static static
COPY --from=node /app/static/css/style.css ./static/css/style.css
EXPOSE 3000
CMD ["/app/blogo", "-path", "/app"]