mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2025-04-03 17:26:43 +02:00
test docker ci
This commit is contained in:
parent
bc541dc0fa
commit
e6fe3022de
7 changed files with 101 additions and 67 deletions
26
.github/workflows/docker-image.yml
vendored
Normal file
26
.github/workflows/docker-image.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
name: Container Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "rewrite-dockerfile" ]
|
||||
pull_request:
|
||||
branches: [ "rewrite-dockerfile" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Build the Base Image
|
||||
run: docker build . --file ./container/base/Dockerfile --tag codeforleipzig-srm-base:$(date +%s)
|
||||
|
||||
- name: Build the Deploy Image
|
||||
run: docker build . --file ./container/deploy/Dockerfile --tag codeforleipzig-srm-deploy:$(date +%s)
|
||||
|
||||
- name: Build the Develop Image
|
||||
run: docker build . --file ./container/develop/Dockerfile --tag codeforleipzig-srm-develop:$(date +%s)
|
||||
|
||||
- name: Build the Test Image
|
||||
run: docker build . --file ./container/test/Dockerfile --tag codeforleipzig-srm-test:$(date +%s)
|
62
Dockerfile
62
Dockerfile
|
@ -1,62 +0,0 @@
|
|||
FROM ruby:3.2.2
|
||||
|
||||
RUN apt-get update && apt-get install -y curl
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
|
||||
|
||||
RUN apt-get update && apt-get install -y ruby ruby-dev ruby-bundler \
|
||||
build-essential zlib1g-dev libsqlite3-dev libxml2-dev libxslt1-dev pkg-config nodejs
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
ENV DOCKERIZE_VERSION v0.6.1
|
||||
RUN curl -sSLO https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
||||
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
||||
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
||||
|
||||
COPY ./docker-entrypoint.sh /
|
||||
RUN chmod +x docker-entrypoint.sh
|
||||
|
||||
RUN mkdir -p /home/srm/tmp
|
||||
#COPY Gemfile.lock /home/srm/tmp/Gemfile.lock
|
||||
|
||||
ARG USER_ID=1000
|
||||
RUN groupadd srm && useradd --uid $USER_ID -g srm srm
|
||||
|
||||
WORKDIR /home/srm/
|
||||
|
||||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
||||
|
||||
ENV NODE_VERSION 18.16.0
|
||||
ENV NVM_DIR /home/srm/.nvm
|
||||
RUN \
|
||||
. ~/.nvm/nvm.sh \
|
||||
&& nvm install $NODE_VERSION \
|
||||
&& nvm alias default $NODE_VERSION \
|
||||
&& nvm use default;
|
||||
|
||||
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
|
||||
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
|
||||
|
||||
RUN gem install bundler
|
||||
|
||||
WORKDIR /
|
||||
RUN mkdir -p /home/srm/build/
|
||||
WORKDIR /home/srm/build/
|
||||
|
||||
COPY bin/ bin/
|
||||
COPY Gemfile Gemfile
|
||||
COPY config/ config/
|
||||
COPY config.ru config.ru
|
||||
COPY package.json package.json
|
||||
|
||||
RUN npm install -g yarn sass
|
||||
RUN bundle update
|
||||
RUN bundle install
|
||||
|
||||
WORKDIR /
|
||||
RUN mkdir -p /home/srm/app/
|
||||
VOLUME /home/srm/app/
|
||||
RUN chown -R srm:srm /home/srm/
|
||||
|
||||
USER srm
|
||||
EXPOSE 3000
|
||||
CMD bundle exec puma -C /home/srm/build/config/puma.rb
|
35
container/base/Dockerfile
Executable file
35
container/base/Dockerfile
Executable file
|
@ -0,0 +1,35 @@
|
|||
# ~~~~~~~~~~~~~~~~~~
|
||||
# ~~~ BASE IMAGE ~~~
|
||||
# ~~~~~~~~~~~~~~~~~~
|
||||
|
||||
FROM docker.io/ruby:3.2.2-alpine3.17 AS base
|
||||
|
||||
RUN apk update && apk add \
|
||||
build-base \
|
||||
curl \
|
||||
linux-headers \
|
||||
nodejs \
|
||||
npm
|
||||
|
||||
ENV DOCKERIZE_VERSION v0.6.1
|
||||
RUN curl -sSLO https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
||||
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
||||
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
||||
|
||||
ARG USER_ID=1000
|
||||
RUN addgroup srm && \
|
||||
adduser --disabled-password --uid $USER_ID --ingroup srm srm
|
||||
|
||||
RUN mkdir -p /home/srm/build/
|
||||
RUN mkdir -p /home/srm/app/
|
||||
RUN chown -R srm:srm /home/srm/
|
||||
|
||||
WORKDIR /home/srm/build/
|
||||
|
||||
COPY Gemfile Gemfile
|
||||
COPY package.json package.json
|
||||
|
||||
RUN npm install -g yarn sass
|
||||
RUN bundle config without development test
|
||||
RUN bundle update
|
||||
RUN bundle install
|
11
container/deploy/Dockerfile
Executable file
11
container/deploy/Dockerfile
Executable file
|
@ -0,0 +1,11 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~
|
||||
# ~~~ DEPLOY IMAGE ~~~
|
||||
# ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
FROM base AS deploy
|
||||
|
||||
WORKDIR /home/srm/app/
|
||||
|
||||
USER srm
|
||||
EXPOSE 3000
|
||||
CMD bundle exec puma -C /home/srm/app/config/puma.rb
|
14
container/develop/Dockerfile
Executable file
14
container/develop/Dockerfile
Executable file
|
@ -0,0 +1,14 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~
|
||||
# ~~~ DEVELOP IMAGE ~~~
|
||||
# ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
FROM base AS development
|
||||
|
||||
RUN bundle config without test
|
||||
RUN bundle update
|
||||
RUN bundle install
|
||||
|
||||
WORKDIR /home/srm/app/
|
||||
|
||||
EXPOSE 3000
|
||||
CMD bundle exec puma -C /home/srm/app/config/puma.rb
|
13
container/test/Dockerfile
Executable file
13
container/test/Dockerfile
Executable file
|
@ -0,0 +1,13 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~
|
||||
# ~~~ TEST IMAGE ~~~
|
||||
# ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
FROM base AS testing
|
||||
|
||||
RUN bundle update
|
||||
RUN bundle install
|
||||
|
||||
WORKDIR /home/srm/app/
|
||||
|
||||
EXPOSE 3000
|
||||
CMD bundle exec puma -C /home/srm/app/config/puma.rb
|
|
@ -1,13 +1,10 @@
|
|||
version: "3.7"
|
||||
services:
|
||||
web:
|
||||
image: ---WIP---
|
||||
user: srm
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
- USER_ID=${USER_ID:-1000}
|
||||
volumes:
|
||||
- .:/home/srm/app/
|
||||
- .:/app/
|
||||
ports:
|
||||
- "3000:3000"
|
||||
links:
|
||||
|
|
Loading…
Add table
Reference in a new issue