👷 building docker iamges with new methods

This commit is contained in:
naiba
2022-07-07 10:27:14 +08:00
parent 563875bfdf
commit deb5b95d8f
3 changed files with 66 additions and 15 deletions

View File

@@ -1,22 +1,20 @@
FROM golang:alpine AS binarybuilder
RUN apk --no-cache --no-progress add \
gcc git musl-dev
WORKDIR /dashboard
COPY . .
RUN cd cmd/dashboard && go build -o app -ldflags="-s -w"
FROM ubuntu:latest
FROM alpine:latest
ARG TARGETPLATFORM
ENV TZ="Asia/Shanghai"
COPY ./script/entrypoint.sh /entrypoint.sh
RUN apk --no-cache --no-progress add \
ca-certificates \
tzdata && \
cp "/usr/share/zoneinfo/$TZ" /etc/localtime && \
echo "$TZ" > /etc/timezone && \
RUN export DEBIAN_FRONTEND="noninteractive" &&
apt update && apt install -y ca-certificates tzdata &&
update-ca-certificates &&
ln -fs /usr/share/zoneinfo/$TZ /etc/localtime &&
dpkg-reconfigure tzdata &&
chmod +x /entrypoint.sh
WORKDIR /dashboard
COPY ./resource ./resource
COPY --from=binarybuilder /dashboard/cmd/dashboard/app ./app
COPY target/$TARGETPLATFORM/dashboard ./app
VOLUME ["/dashboard/data"]
EXPOSE 80 5555