chore: make Docker great again
This commit is contained in:
parent
2d3c1f3ab0
commit
f88a9b4802
3 changed files with 35 additions and 24 deletions
|
@ -3,9 +3,8 @@ image: php:8.2
|
||||||
stages:
|
stages:
|
||||||
- setup
|
- setup
|
||||||
- build
|
- build
|
||||||
- build-docker
|
- docker
|
||||||
- publish
|
- publish
|
||||||
- publish-docker
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- apt update -yqq
|
- apt update -yqq
|
||||||
|
@ -51,9 +50,9 @@ build-debian:
|
||||||
- build/*.deb
|
- build/*.deb
|
||||||
|
|
||||||
# Build the Alpine Docker image
|
# Build the Alpine Docker image
|
||||||
ncc-docker-build-alpine:
|
docker-alpine:
|
||||||
image: docker:latest
|
image: docker:latest
|
||||||
stage: build-docker
|
stage: docker
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -61,22 +60,22 @@ ncc-docker-build-alpine:
|
||||||
script:
|
script:
|
||||||
- |
|
- |
|
||||||
if [[ "$CI_COMMIT_BRANCH" == "master" ]]; then
|
if [[ "$CI_COMMIT_BRANCH" == "master" ]]; then
|
||||||
DOCKER_TAG="latest-alpine"
|
DOCKER_TAG="latest"
|
||||||
elif [[ ! -z "$CI_COMMIT_TAG" ]]; then
|
elif [[ ! -z "$CI_COMMIT_TAG" ]]; then
|
||||||
DOCKER_TAG="$CI_COMMIT_TAG-alpine"
|
DOCKER_TAG="$CI_COMMIT_TAG"
|
||||||
else
|
else
|
||||||
DOCKER_TAG="$CI_COMMIT_REF_SLUG-alpine"
|
DOCKER_TAG="$CI_COMMIT_REF_SLUG"
|
||||||
fi
|
fi
|
||||||
- docker build -f Dockerfile.alpine -t $CI_REGISTRY_IMAGE:$DOCKER_TAG .
|
- docker build -f Dockerfile -t $CI_REGISTRY_IMAGE:$DOCKER_TAG .
|
||||||
- docker push $CI_REGISTRY_IMAGE:$DOCKER_TAG
|
- docker push $CI_REGISTRY_IMAGE:$DOCKER_TAG
|
||||||
rules:
|
rules:
|
||||||
- exists:
|
- exists:
|
||||||
- Dockerfile.alpine
|
- Dockerfile
|
||||||
|
|
||||||
# Build the Debian Docker image
|
# Build the Debian Docker image
|
||||||
ncc-docker-build-debian:
|
docker-debian:
|
||||||
image: docker:latest
|
image: docker:latest
|
||||||
stage: build-docker
|
stage: docker
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -84,7 +83,7 @@ ncc-docker-build-debian:
|
||||||
script:
|
script:
|
||||||
- |
|
- |
|
||||||
if [[ "$CI_COMMIT_BRANCH" == "master" ]]; then
|
if [[ "$CI_COMMIT_BRANCH" == "master" ]]; then
|
||||||
DOCKER_TAG="latest-debian"
|
DOCKER_TAG="debian"
|
||||||
elif [[ ! -z "$CI_COMMIT_TAG" ]]; then
|
elif [[ ! -z "$CI_COMMIT_TAG" ]]; then
|
||||||
DOCKER_TAG="$CI_COMMIT_TAG-debian"
|
DOCKER_TAG="$CI_COMMIT_TAG-debian"
|
||||||
else
|
else
|
||||||
|
|
|
@ -18,9 +18,17 @@
|
||||||
# This image is intended to be used as a base for projects using ncc.
|
# This image is intended to be used as a base for projects using ncc.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Builder stage: downloads necessary files and serves them on a silver platter.
|
# OSI labels and build-time args/envs
|
||||||
FROM php:8.2-fpm AS builder
|
LABEL maintainer="Netkas <netkas@nosial.net>"
|
||||||
|
LABEL description="ncc's official Docker image"
|
||||||
|
|
||||||
ENV GENERIC_BUILD_PATH=/tmp/ncc_build
|
ENV GENERIC_BUILD_PATH=/tmp/ncc_build
|
||||||
|
|
||||||
|
ARG PHP_VERSION=8.2
|
||||||
|
|
||||||
|
|
||||||
|
# Builder stage: downloads necessary files and serves them on a silver platter.
|
||||||
|
FROM php:{PHP_VERSION}-fpm AS builder
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
|
|
||||||
# Install some stuff the default image doesn't come with
|
# Install some stuff the default image doesn't come with
|
||||||
|
@ -43,13 +51,11 @@ RUN cd /tmp/ncc && make redist
|
||||||
|
|
||||||
|
|
||||||
# Main stage: Copies build files and installs all dependencies
|
# Main stage: Copies build files and installs all dependencies
|
||||||
FROM php:8.2-fpm-alpine AS production
|
FROM php:{PHP_VERSION}-fpm-alpine AS production
|
||||||
LABEL maintainer="netkas <netkas@nosial.net>"
|
|
||||||
LABEL description="ncc alpine docker image"
|
|
||||||
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
|
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
|
||||||
|
|
||||||
# Copy downloaded files
|
# Copy downloaded files
|
||||||
COPY --from=builder /tmp/ncc_build/. .
|
COPY --from=builder ${GENERIC_BUILD_PATH}/. .
|
||||||
|
|
||||||
# Install some stuff the default image doesn't come with
|
# Install some stuff the default image doesn't come with
|
||||||
RUN apk update && \
|
RUN apk update && \
|
|
@ -18,9 +18,17 @@
|
||||||
# This image is intended to be used as a base for projects using ncc.
|
# This image is intended to be used as a base for projects using ncc.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Builder stage: downloads necessary files and serves them on a silver platter.
|
# OSI labels and build-time args/envs
|
||||||
FROM php:8.2-fpm AS builder
|
LABEL maintainer="Netkas <netkas@nosial.net>"
|
||||||
|
LABEL description="ncc's official Docker image"
|
||||||
|
|
||||||
ENV GENERIC_BUILD_PATH=/tmp/ncc_build
|
ENV GENERIC_BUILD_PATH=/tmp/ncc_build
|
||||||
|
|
||||||
|
ARG PHP_VERSION=8.2
|
||||||
|
|
||||||
|
|
||||||
|
# Builder stage: downloads necessary files and serves them on a silver platter.
|
||||||
|
FROM php:{PHP_VERSION}-fpm AS builder
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
|
|
||||||
# Install some stuff the default image doesn't come with
|
# Install some stuff the default image doesn't come with
|
||||||
|
@ -43,13 +51,11 @@ RUN cd /tmp/ncc && make redist
|
||||||
|
|
||||||
|
|
||||||
# Main stage: Copies build files and installs all dependencies
|
# Main stage: Copies build files and installs all dependencies
|
||||||
FROM php:8.2-fpm AS production
|
FROM php:{PHP_VERSION}-fpm AS production
|
||||||
LABEL maintainer="netkas <netkas@nosial.net>"
|
|
||||||
LABEL description="ncc debian docker image"
|
|
||||||
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
|
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
|
||||||
|
|
||||||
# Copy downloaded files
|
# Copy downloaded files
|
||||||
COPY --from=builder /tmp/ncc_build/. .
|
COPY --from=builder ${GENERIC_BUILD_PATH}/. .
|
||||||
|
|
||||||
# Install some stuff the default image doesn't come with
|
# Install some stuff the default image doesn't come with
|
||||||
RUN apt-get update -yqq && \
|
RUN apt-get update -yqq && \
|
||||||
|
|
Loading…
Add table
Reference in a new issue