forked from akhilrex/hammond
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
41 lines (37 loc) · 1.03 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
ARG GO_VERSION=1.20.6
FROM golang:${GO_VERSION}-alpine AS builder
RUN apk update && apk add alpine-sdk git && rm -rf /var/cache/apk/*
RUN mkdir -p /api
WORKDIR /api
COPY ./server/go.mod .
COPY ./server/go.sum .
RUN go mod download
COPY ./server .
RUN go build -o ./app ./main.go
FROM node:16-alpine as build-stage
WORKDIR /app
COPY ./ui/package*.json ./
RUN apk add --no-cache autoconf automake build-base nasm libc6-compat python3 py3-pip make g++ libpng-dev zlib-dev pngquant
RUN npm install
COPY ./ui .
RUN npm run build
FROM alpine:latest
LABEL org.opencontainers.image.source="https://github.com/alfhou/hammond"
ENV CONFIG=/config
ENV DATA=/assets
ENV UID=998
ENV PID=100
ENV GIN_MODE=release
VOLUME ["/config", "/assets"]
RUN apk update && apk add ca-certificates tzdata && rm -rf /var/cache/apk/*
RUN mkdir -p /config; \
mkdir -p /assets; \
mkdir -p /api
RUN chmod 777 /config; \
chmod 777 /assets
WORKDIR /api
COPY --from=builder /api/app .
#COPY dist ./dist
COPY --from=build-stage /app/dist ./dist
EXPOSE 3000
ENTRYPOINT ["./app"]