improve sia docker builder image

This commit is contained in:
Karol Wypchlo 2020-07-30 12:23:24 +02:00
parent 17d4a1ad53
commit bcb73eceb2
2 changed files with 13 additions and 41 deletions

View File

@ -6,7 +6,11 @@ networks:
services: services:
sia: sia:
image: nebulouslabs/sia:dev build:
context: ./docker/sia
dockerfile: Dockerfile
args:
branch: master
container_name: sia container_name: sia
restart: unless-stopped restart: unless-stopped
environment: environment:
@ -21,7 +25,7 @@ services:
- 9980 - 9980
sia-upload-legacy: sia-upload-legacy:
image: nebulouslabs/sia:dev image: nebulouslabs/sia:alpine-latest
container_name: sia-upload-legacy container_name: sia-upload-legacy
restart: unless-stopped restart: unless-stopped
environment: environment:

View File

@ -1,46 +1,14 @@
FROM golang AS builder FROM golang AS sia-builder
LABEL maintainer="NebulousLabs <devs@nebulous.tech>"
ENV GOOS linux ENV GOOS linux
ENV GOARCH amd64 ENV GOARCH amd64
RUN git clone https://gitlab.com/NebulousLabs/Sia.git && \ ARG branch=master
cd Sia && \
git checkout master && \
make release
RUN git clone https://github.com/NebulousLabs/docker-sia.git /docker-sia RUN git clone https://gitlab.com/NebulousLabs/Sia.git --single-branch --branch ${branch}
RUN make release --directory Sia
FROM alpine:3 FROM nebulouslabs/sia:alpine-latest
LABEL maintainer="NebulousLabs <devs@nebulous.tech>"
LABEL autoheal=true
ARG SIA_DIR="/sia" COPY --from=sia-builder /go/bin/siac /sia/siac
ARG SIA_DATA_DIR="/sia-data" COPY --from=sia-builder /go/bin/siad /sia/siad
ARG SIAD_DATA_DIR="/sia-data"
RUN mkdir /lib64 && \
ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 && \
apk add --no-cache socat
# Workaround for backwards compatibility with old images, which hardcoded the
# Sia data directory as /mnt/sia. Creates a symbolic link so that any previous
# path references stored in the Sia host config still work.
RUN ln -s "$SIA_DATA_DIR" /mnt/sia
WORKDIR "$SIA_DIR"
ENV SIA_DATA_DIR "$SIA_DATA_DIR"
ENV SIAD_DATA_DIR "$SIAD_DATA_DIR"
ENV SIA_MODULES gctwhr
COPY --from=builder /go/bin/siac .
COPY --from=builder /go/bin/siad .
COPY --from=builder /docker-sia/scripts/healthcheck.sh .
COPY --from=builder /docker-sia/scripts/run.sh .
EXPOSE 9980 9981 9982
HEALTHCHECK --interval=10s CMD ["./healthcheck.sh"]
ENTRYPOINT ["./run.sh"]