2019-09-18 09:15:13 +02:00
|
|
|
# syntax = docker/dockerfile:1.1-experimental
|
2019-09-18 08:35:17 +02:00
|
|
|
|
2019-09-18 07:16:43 +02:00
|
|
|
#
|
2019-09-18 07:21:43 +02:00
|
|
|
# MetaCall Guix by Parra Studios
|
|
|
|
# Docker image for using GuixSD in a CI/CD environment.
|
2019-09-18 07:16:43 +02:00
|
|
|
#
|
|
|
|
# Copyright (C) 2016 - 2019 Vicente Eduardo Ferrer Garcia <vic798@gmail.com>
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
FROM alpine:latest AS guix
|
|
|
|
|
|
|
|
# Image descriptor
|
|
|
|
LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \
|
|
|
|
copyright.address="vic798@gmail.com" \
|
|
|
|
maintainer.name="Vicente Eduardo Ferrer Garcia" \
|
|
|
|
maintainer.address="vic798@gmail.com" \
|
|
|
|
vendor="MetaCall Inc." \
|
|
|
|
version="0.1"
|
|
|
|
|
2019-09-19 09:30:12 +02:00
|
|
|
ARG METACALL_GUIX_VERSION
|
|
|
|
ARG METACALL_GUIX_ARCH
|
|
|
|
|
2019-09-19 21:45:11 +02:00
|
|
|
ENV GUIX_PROFILE="/root/.config/guix/current" \
|
2019-09-20 15:42:20 +02:00
|
|
|
GUIX_LOCPATH="/root/.guix-profile/lib/locale/" \
|
2019-11-26 21:13:34 +01:00
|
|
|
LANG="en_US.utf8" \
|
2019-11-26 22:43:49 +01:00
|
|
|
LC_ALL="en_US.utf8" \
|
2019-11-26 21:13:34 +01:00
|
|
|
LANGUAGE="en_US.utf8" \
|
2019-09-20 15:42:20 +02:00
|
|
|
SSL_CERT_DIR="/root/.guix-profile/etc/ssl/certs" \
|
|
|
|
GIT_SSL_FILE="/root/.guix-profile/etc/ssl/certs/ca-certificates.crt" \
|
|
|
|
GIT_SSL_CAINFO="$GIT_SSL_FILE"
|
2019-09-18 07:16:43 +02:00
|
|
|
|
2019-09-19 09:30:12 +02:00
|
|
|
# Copy entry point
|
|
|
|
COPY scripts/entry-point.sh /entry-point.sh
|
|
|
|
|
2019-09-19 21:45:11 +02:00
|
|
|
# Install Guix
|
|
|
|
RUN apk add --no-cache --update --virtual .build-deps shadow \
|
2019-09-18 07:16:43 +02:00
|
|
|
&& mkdir -p /gnu/store \
|
|
|
|
&& addgroup guixbuild \
|
|
|
|
&& addgroup guix-builder \
|
|
|
|
&& chgrp guix-builder -R /gnu/store \
|
|
|
|
&& chmod 1775 /gnu/store \
|
|
|
|
&& for i in `seq -w 1 10`; do \
|
|
|
|
useradd -g guixbuild -G guixbuild -d /var/empty -s `which nologin` -c "Guix build user $i" --system guixbuilder$i; \
|
|
|
|
done \
|
2019-09-19 09:30:12 +02:00
|
|
|
&& apk del .build-deps \
|
|
|
|
&& wget -O - https://ftp.gnu.org/gnu/guix/guix-binary-${METACALL_GUIX_VERSION}.${METACALL_GUIX_ARCH}-linux.tar.xz | tar -xJv -C / \
|
2019-09-20 15:42:20 +02:00
|
|
|
&& mkdir -p /root/.config/guix \
|
|
|
|
&& ln -sf /var/guix/profiles/per-user/root/current-guix /root/.config/guix/current \
|
2019-09-18 07:16:43 +02:00
|
|
|
&& source $GUIX_PROFILE/etc/profile \
|
|
|
|
&& mkdir -p /usr/local/bin \
|
|
|
|
&& ln -s /var/guix/profiles/per-user/root/current-guix/bin/guix /usr/local/bin/ \
|
|
|
|
&& mkdir -p /usr/local/share/info \
|
|
|
|
&& for i in /var/guix/profiles/per-user/root/current-guix/share/info/*; do \
|
|
|
|
ln -s $i /usr/local/share/info/; \
|
|
|
|
done \
|
2019-09-20 15:42:20 +02:00
|
|
|
&& guix archive --authorize < /root/.config/guix/current/share/guix/ci.guix.gnu.org.pub \
|
2019-09-19 21:45:11 +02:00
|
|
|
&& chmod +x /entry-point.sh
|
|
|
|
|
|
|
|
# Run pull (https://github.com/docker/buildx/blob/master/README.md#--allowentitlement)
|
2019-09-26 21:07:44 +02:00
|
|
|
RUN --security=insecure /entry-point.sh guix pull \
|
2019-11-26 22:19:12 +01:00
|
|
|
&& guix package -u
|
2019-09-19 19:46:33 +02:00
|
|
|
|
2019-09-18 07:16:43 +02:00
|
|
|
ENTRYPOINT ["/entry-point.sh"]
|
|
|
|
CMD ["sh"]
|