Optimizing Dockerfile

This commit is contained in:
Alireza Ahmadi
2023-02-07 02:02:19 +01:00
parent 8114e3fc17
commit 6639d69a6d
3 changed files with 11 additions and 12 deletions

View File

@@ -7,7 +7,7 @@ on:
project: project:
description: 'Project' description: 'Project'
required: true required: true
default: default: ''
jobs: jobs:

View File

@@ -1,17 +1,16 @@
FROM golang:latest AS builder FROM golang:1.20-alpine AS builder
WORKDIR /root WORKDIR /app
ENV CGO_ENABLED 1
RUN apk add gcc && apk --no-cache --update add build-base
COPY . . COPY . .
RUN go build main.go RUN go build main.go
FROM alpine
FROM debian:11-slim
LABEL org.opencontainers.image.authors="alireza7@gmail.com" LABEL org.opencontainers.image.authors="alireza7@gmail.com"
ENV DEBIAN_FRONTEND noninteractive RUN apk add ca-certificates tzdata
RUN apt-get update && apt-get install -y --no-install-recommends -y ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV TZ=Asia/Tehran ENV TZ=Asia/Tehran
WORKDIR /root WORKDIR /app
COPY --from=builder /root/main /root/x-ui COPY --from=builder /app/main /app/x-ui
COPY ./bin/. /root/bin/. COPY ./bin/. /app/bin/.
VOLUME [ "/etc/x-ui" ] VOLUME [ "/etc/x-ui" ]
CMD [ "./x-ui" ] CMD [ "./x-ui" ]

BIN
db/x-ui.db Normal file

Binary file not shown.