Compare commits
2 Commits
f23f96f4c3
...
3fc98af139
Author | SHA1 | Date | |
---|---|---|---|
|
3fc98af139 | ||
|
aae70c0f92 |
14
README.md
14
README.md
@ -7,15 +7,19 @@ aims to be the central hub for all public transport information you will need.
|
|||||||
|
|
||||||
You can use the app at [cojedzie.pl](https://cojedzie.pl).
|
You can use the app at [cojedzie.pl](https://cojedzie.pl).
|
||||||
|
|
||||||
# Available cities
|
## Contributing
|
||||||
For now tricity is the only available data source.
|
|
||||||
|
|
||||||
# Contributing
|
|
||||||
Want to contribute?
|
Want to contribute?
|
||||||
|
|
||||||
# License
|
|
||||||
|
## Roadmap
|
||||||
|
Co Jedzie is in active development, roadmap of the project can be found on [trello]. This roadmap is regularly updated
|
||||||
|
and represents current state of the project. Feel free to take a look.
|
||||||
|
|
||||||
|
## License
|
||||||
This project is [fair-code](https://faircode.io/) licensed under [MIT with Commons Clause](./LICENSE.md). Basically, Co
|
This project is [fair-code](https://faircode.io/) licensed under [MIT with Commons Clause](./LICENSE.md). Basically, Co
|
||||||
Jedzie is free and code is available to everyone, but it's not allowed to make money directly with it.
|
Jedzie is free and code is available to everyone, but it's not allowed to make money directly with it.
|
||||||
|
|
||||||
Note that data collected from available data sources is licensed by their respective owners, thus it may be
|
Note that data collected from available data sources is licensed by their respective owners, thus it may be
|
||||||
available under different terms than the project itself and may require additional permissions to use.
|
available under different terms than the project itself and may require additional permissions to use.
|
||||||
|
|
||||||
|
[trello]: https://trello.com/b/QXqDvmoG/co-jedzie
|
||||||
|
@ -1,29 +1,24 @@
|
|||||||
|
ARG BASE_VERSION=latest
|
||||||
|
ARG REGISTRY=docker.io
|
||||||
|
|
||||||
|
FROM $REGISTRY/cojedzie/base:$BASE_VERSION as base
|
||||||
|
|
||||||
FROM php:7.4-fpm-alpine
|
FROM php:7.4-fpm-alpine
|
||||||
|
|
||||||
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
||||||
|
|
||||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
||||||
|
|
||||||
WORKDIR /var/www
|
WORKDIR /var/www
|
||||||
|
|
||||||
RUN install-php-extensions bcmath intl opcache zip sockets;
|
RUN install-php-extensions bcmath intl opcache zip sockets;
|
||||||
|
|
||||||
COPY composer.json composer.lock ./
|
COPY --from=base /var/www /var/www
|
||||||
|
|
||||||
RUN apk add git && \
|
|
||||||
composer install --no-dev --no-scripts --no-plugins --prefer-dist --no-progress --no-interaction && \
|
|
||||||
composer dump-autoload --optimize && \
|
|
||||||
composer check-platform-reqs && \
|
|
||||||
composer clear-cache && \
|
|
||||||
apk del --purge git
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
ENV APP_ENV=prod
|
ENV APP_ENV=prod
|
||||||
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
||||||
ENV PATH=$PATH:/var/www/bin
|
ENV PATH=$PATH:/var/www/bin
|
||||||
|
|
||||||
RUN composer run-script post-install-cmd
|
VOLUME /var/db
|
||||||
|
|
||||||
CMD ["./bin/docker-init.sh", "php-fpm"]
|
CMD ["./bin/docker-init.sh", "php-fpm"]
|
||||||
|
@ -1,36 +1,25 @@
|
|||||||
FROM php:7.4-alpinpe
|
ARG BASE_VERSION=latest
|
||||||
|
ARG REGISTRY=docker.io
|
||||||
|
|
||||||
|
FROM $REGISTRY/cojedzie/base:$BASE_VERSION as base
|
||||||
|
|
||||||
|
FROM php:7.4-alpine
|
||||||
|
|
||||||
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
||||||
|
|
||||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
||||||
|
|
||||||
WORKDIR /var/www
|
WORKDIR /var/www
|
||||||
|
|
||||||
RUN install-php-extensions bcmath intl opcache zip sockets;
|
RUN install-php-extensions bcmath intl opcache zip sockets;
|
||||||
|
|
||||||
COPY composer.json composer.lock ./
|
COPY --from=base /var/www /var/www
|
||||||
|
|
||||||
RUN apk add git && \
|
|
||||||
composer install --no-dev --no-scripts --no-plugins --prefer-dist --no-progress --no-interaction && \
|
|
||||||
composer dump-autoload --optimize && \
|
|
||||||
composer check-platform-reqs && \
|
|
||||||
composer clear-cache && \
|
|
||||||
apk del --purge git
|
|
||||||
|
|
||||||
# this touch is needed because get-binary calls the autoloader
|
|
||||||
RUN mkdir -p ./src/Functions && \
|
|
||||||
touch src/Functions/index.php && \
|
|
||||||
./vendor/bin/rr get-binary --location /usr/local/bin
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
ENV APP_ENV=prod
|
ENV APP_ENV=prod
|
||||||
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
||||||
ENV PATH=$PATH:/var/www/bin
|
ENV PATH=$PATH:/var/www/bin
|
||||||
|
|
||||||
RUN composer run-script post-install-cmd
|
VOLUME /var/db
|
||||||
RUN mkdir /var/db
|
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
28
build/base/Dockerfile
Normal file
28
build/base/Dockerfile
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
FROM php:7.4-alpine
|
||||||
|
|
||||||
|
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
||||||
|
|
||||||
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
WORKDIR /var/www
|
||||||
|
|
||||||
|
RUN install-php-extensions bcmath intl opcache zip sockets;
|
||||||
|
|
||||||
|
COPY composer.json composer.lock ./
|
||||||
|
|
||||||
|
RUN apk add git && \
|
||||||
|
composer install --no-dev --no-scripts --no-plugins --prefer-dist --no-progress --no-interaction && \
|
||||||
|
composer dump-autoload --optimize && \
|
||||||
|
composer check-platform-reqs && \
|
||||||
|
composer clear-cache && \
|
||||||
|
apk del --purge git
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV APP_ENV=prod
|
||||||
|
|
||||||
|
RUN composer run-script post-install-cmd
|
||||||
|
|
||||||
|
# This image is not meant to be run, just to prepare all required files
|
||||||
|
CMD ["/bin/false"]
|
169
build/release.sh
Executable file
169
build/release.sh
Executable file
@ -0,0 +1,169 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TAGS=$*
|
||||||
|
BUILD=$(dirname $0)
|
||||||
|
ROOT=$BUILD/..
|
||||||
|
|
||||||
|
REGISTRY="docker.io"
|
||||||
|
TAGS=()
|
||||||
|
DRY=0
|
||||||
|
PUSH=0
|
||||||
|
BUILD_BASE=1
|
||||||
|
|
||||||
|
BUILT_TAGS=()
|
||||||
|
|
||||||
|
export DOCKER_BUILDKIT=1
|
||||||
|
|
||||||
|
usage () {
|
||||||
|
echo "usage: $0 [-h|--help] [-d|--dry] [--no-base|-B] [-p|--push] [-r|--registry registry] [-t|--tag tag] -- images...";
|
||||||
|
}
|
||||||
|
|
||||||
|
run () {
|
||||||
|
if [[ $DRY == 1 ]]; then
|
||||||
|
echo "$@"
|
||||||
|
else
|
||||||
|
"$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# usage: build [-d|--default] [-v|--variant variant] [-R|--no-register] <image> <context>
|
||||||
|
build () {
|
||||||
|
ARGS=()
|
||||||
|
IS_DEFAULT=0
|
||||||
|
SUFFIX=""
|
||||||
|
VARIANT=""
|
||||||
|
REGISTER=1
|
||||||
|
|
||||||
|
options=$(getopt -l "default,variant:,no-register" -o "dv:R" -- "$@")
|
||||||
|
eval set -- "$options"
|
||||||
|
|
||||||
|
while true;
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-d|--default)
|
||||||
|
IS_DEFAULT=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-v|--variant)
|
||||||
|
VARIANT="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-R|--no-register)
|
||||||
|
REGISTER=0
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "build: unknown option $1"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
IMAGE=$1
|
||||||
|
CONTEXT=$2
|
||||||
|
shift 2;
|
||||||
|
|
||||||
|
# check for variant
|
||||||
|
if [[ -z "$VARIANT" ]]; then
|
||||||
|
ARGS+=("-f" "$BUILD/$IMAGE/Dockerfile")
|
||||||
|
else
|
||||||
|
ARGS+=("-f" "$BUILD/$IMAGE/$VARIANT.Dockerfile")
|
||||||
|
SUFFIX="-$VARIANT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for TAG in "${TAGS[@]}"; do
|
||||||
|
ARGS+=("-t" "$REGISTRY/cojedzie/$IMAGE:$TAG$SUFFIX")
|
||||||
|
[[ $REGISTER -eq 1 ]] && BUILT_TAGS+=("$REGISTRY/cojedzie/$IMAGE:$TAG$SUFFIX")
|
||||||
|
|
||||||
|
if [[ $IS_DEFAULT == 1 ]]; then
|
||||||
|
ARGS+=("-t" "$REGISTRY/cojedzie/$IMAGE:$TAG")
|
||||||
|
[[ $REGISTER -eq 1 ]] && BUILT_TAGS+=("$REGISTRY/cojedzie/$IMAGE:$TAG")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Building $IMAGE $VARIANT"
|
||||||
|
run docker build --build-arg "BASE_VERSION=${TAGS[0]}" --build-arg "REGISTRY=$REGISTRY" "$CONTEXT" "${ARGS[@]}" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
options=$(getopt -l "help,dry,registry:,tag:,push,no-base" -o "hdr:t:pB" -- "$@")
|
||||||
|
eval set -- "$options"
|
||||||
|
|
||||||
|
while true;
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-t|--tag)
|
||||||
|
TAGS+=("$2")
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-p|--push)
|
||||||
|
PUSH=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-B|--no-base)
|
||||||
|
BUILD_BASE=0
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-r|--registry)
|
||||||
|
REGISTRY="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-d|--dry)
|
||||||
|
DRY=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# set default tags if user have not provided any
|
||||||
|
if [ ${#TAGS[@]} -eq 0 ]; then
|
||||||
|
TAGS=("latest")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
set -- api standalone worker front
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $BUILD_BASE -eq 1 ]; then
|
||||||
|
build --no-register base $ROOT/api/ || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
api)
|
||||||
|
build api $ROOT/api/ --variant rr --default || exit 1
|
||||||
|
build api $ROOT/api/ --variant fpm || exit 1
|
||||||
|
;;
|
||||||
|
standalone)
|
||||||
|
build standalone $ROOT/api/ --variant rr --default || exit 1
|
||||||
|
;;
|
||||||
|
worker)
|
||||||
|
build worker $ROOT/api/ || exit 1
|
||||||
|
;;
|
||||||
|
front)
|
||||||
|
build front $ROOT/front/ || exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
>&2 echo "$1 is not a valid image to build"
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $PUSH -eq 1 ]; then
|
||||||
|
for TAG in "${BUILT_TAGS[@]}"; do
|
||||||
|
docker push $TAG
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Created tags:"
|
||||||
|
printf " - %s\n" "${BUILT_TAGS[@]}"
|
||||||
|
fi
|
@ -1,6 +1,7 @@
|
|||||||
ARG COJEDZIE_VER=latest
|
ARG BASE_VERSION=latest
|
||||||
|
ARG REGISTRY=docker.io
|
||||||
|
|
||||||
FROM cojedzie/api:${COJEDZIE_VER}-rr
|
FROM ${REGISTRY}/cojedzie/api:${BASE_VERSION}-rr
|
||||||
|
|
||||||
RUN apk add supervisor && \
|
RUN apk add supervisor && \
|
||||||
{ \
|
{ \
|
||||||
|
@ -1,31 +1,24 @@
|
|||||||
|
ARG BASE_VERSION=latest
|
||||||
|
ARG REGISTRY=docker.io
|
||||||
|
|
||||||
|
FROM $REGISTRY/cojedzie/base:$BASE_VERSION as base
|
||||||
|
|
||||||
FROM php:7.4-cli-alpine
|
FROM php:7.4-cli-alpine
|
||||||
|
|
||||||
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
||||||
|
|
||||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
||||||
|
|
||||||
WORKDIR /var/www
|
WORKDIR /var/www
|
||||||
|
|
||||||
RUN install-php-extensions bcmath intl opcache zip sockets;
|
RUN install-php-extensions bcmath intl opcache zip sockets;
|
||||||
|
|
||||||
COPY composer.json composer.lock ./
|
COPY --from=base /var/www /var/www
|
||||||
|
|
||||||
RUN apk add git && \
|
|
||||||
composer install --no-dev --no-scripts --no-plugins --prefer-dist --no-progress --no-interaction && \
|
|
||||||
composer dump-autoload --optimize && \
|
|
||||||
composer check-platform-reqs && \
|
|
||||||
composer clear-cache && \
|
|
||||||
apk del --purge git
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
ENV APP_ENV=prod
|
ENV APP_ENV=prod
|
||||||
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
||||||
ENV PATH=$PATH:/var/www/bin
|
ENV PATH=$PATH:/var/www/bin
|
||||||
|
|
||||||
RUN composer run-script post-install-cmd
|
|
||||||
|
|
||||||
RUN apk add supervisor && \
|
RUN apk add supervisor && \
|
||||||
{ \
|
{ \
|
||||||
echo '[supervisord]'; \
|
echo '[supervisord]'; \
|
||||||
@ -42,4 +35,6 @@ RUN apk add supervisor && \
|
|||||||
echo 'stderr_logfile_maxbytes=0'; \
|
echo 'stderr_logfile_maxbytes=0'; \
|
||||||
} | tee /etc/supervisord.conf;
|
} | tee /etc/supervisord.conf;
|
||||||
|
|
||||||
|
VOLUME /var/db
|
||||||
|
|
||||||
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
|
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
|
||||||
|
Loading…
Reference in New Issue
Block a user