Commit 4f7af540 authored by Konrad Borowski's avatar Konrad Borowski

Merge branch 'autodevops' into 'master'

Provide Docker image for AutoDevOps

See merge request !101
parents 28ba6a21 128412e0
Pipeline #107840651 passed with stages
in 28 minutes and 42 seconds
.git
node_modules
static/js
target
include:
- template: Auto-DevOps.gitlab-ci.yml
variables:
DAST_DISABLED: 'true'
build:webpack:
stage: build
image: node:12.13
......@@ -16,6 +22,8 @@ build:release: &build
- &init rustc --version && cargo --version
- cargo build --release --verbose
- &clean_cargo cargo install cargo-cache --git https://github.com/matthiaskrgr/cargo-cache --no-default-features --features ci-autoclean && cargo-cache
needs:
- build:webpack
artifacts:
paths:
- languages.json
......@@ -42,6 +50,8 @@ test:stable: &test
- *init
- DATABASE_URL=postgresql://user:password@postgres/db SANDBOX_URL=http://sandbox:8888 cargo test --verbose --features=database_tests,sandbox_tests
- *clean_cargo
needs:
- build:webpack
cache:
key: ${CI_JOB_NAME}
paths:
......
FROM node:12 AS node
COPY package.json package-lock.json ./
RUN npm ci
COPY js js
COPY tsconfig.json webpack.config.js ./
RUN node_modules/.bin/webpack
FROM rust:1.40 AS rust
WORKDIR /build
COPY Cargo.lock Cargo.toml ./
RUN mkdir src
RUN touch src/main.rs
RUN cargo build --release || true
COPY src src
COPY templates templates
COPY --from=node entry ./
RUN cargo build --release
FROM debian:buster
RUN apt-get update \
&& apt-get install -y --no-install-recommends libpq5=11.5-1+deb10u1 libssl1.1=1.1.1d-0+deb10u2 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY migrations migrations
COPY static static
COPY migrations languages.json ./
COPY --from=node static static
COPY --from=rust build/target/release/pastebinrun pastebinrun
ENTRYPOINT ["./pastebinrun"]
EXPOSE 8080/tcp
version: '3.7'
services:
pastebinrun:
depends_on:
- db
- sandbox
build: .
ports:
- 127.0.0.1:8080:8080
restart: always
environment:
DATABASE_URL: postgresql://postgres@db
SANDBOX_URL: http://sandbox:8888
RUST_LOG: info
db:
image: postgres:12
restart: always
sandbox:
image: registry.gitlab.com/pastebinrun/sandbox/master
restart: always
......@@ -20,7 +20,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.expect("Couldn't create a connection connection");
diesel_migrations::run_pending_migrations(&pool.get()?)?;
migration::run(&pool.get()?)?;
warp::serve(routes::routes(pool)).run(([127, 0, 0, 1], 8080));
warp::serve(routes::routes(pool)).run(([0, 0, 0, 0], 8080));
Ok(())
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment