Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nanawel committed May 5, 2021
0 parents commit 60100e5
Show file tree
Hide file tree
Showing 74 changed files with 21,570 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2

[*.js]
insert_final_newline = true
trim_trailing_whitespace = true
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
COMPOSE_PROJECT_NAME=osl
node_version=15
node_variant=-alpine
node_variant_dev=-buster
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/node_modules
*.bak
.history
48 changes: 48 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
variables:
APP_IMAGE: "osl_app"
COMPOSE_FILE: "docker-compose.build.yml"
CONTAINER_RELEASE_IMAGE: "nanawel/our-shopping-list"

stages:
- check
- build
- release

before_script:
- time docker info
- time docker login ${REGISTRY_SERVER}

build_image:
stage: build
script:
- time make config
- time make build args="--build-arg version=${CI_COMMIT_REF_SLUG} --build-arg build_id=${CI_COMMIT_SHORT_SHA}"
- time docker tag ${APP_IMAGE}:${APP_VERSION:-latest} ${CONTAINER_RELEASE_IMAGE}:${CI_COMMIT_SHORT_SHA}
- time docker push ${CONTAINER_RELEASE_IMAGE}:${CI_COMMIT_SHORT_SHA}
tags:
- shell
- docker

push_image_latest:
stage: release
script:
- time docker pull ${CONTAINER_RELEASE_IMAGE}:${CI_COMMIT_SHORT_SHA}
- time docker tag ${CONTAINER_RELEASE_IMAGE}:${CI_COMMIT_SHORT_SHA} ${CONTAINER_RELEASE_IMAGE}:latest
- time docker push ${CONTAINER_RELEASE_IMAGE}:latest
tags:
- shell
- docker
only:
- master

push_image_tagged:
stage: release
script:
- time docker pull ${CONTAINER_RELEASE_IMAGE}:${CI_COMMIT_SHORT_SHA}
- time docker tag ${CONTAINER_RELEASE_IMAGE}:${CI_COMMIT_SHORT_SHA} ${CONTAINER_RELEASE_IMAGE}:${CI_COMMIT_REF_SLUG}
- time docker push ${CONTAINER_RELEASE_IMAGE}:${CI_COMMIT_REF_SLUG}
tags:
- shell
- docker
only:
- /^\d+\.\d+\.\d+.*
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
ARG node_version="15"
ARG node_variant="-alpine"
ARG version
ARG build_id

FROM node:${node_version}${node_variant} as client-builder

COPY ./client/ /app/client

RUN cd /app/client \
&& yarn install \
&& yarn build

FROM node:${node_version}${node_variant}

ARG version
ARG build_id

LABEL app-name="Our Shopping List"
LABEL maintainer="Anaël Ollier <[email protected]>"

ENV APP_VERSION=${version}
ENV APP_BUILD_ID=${build_id}

COPY ./ /app
COPY --from=client-builder /app/client /app/client

WORKDIR /app

RUN yarn install --production

CMD [ "node", "server.js" ]
EXPOSE 8080
Loading

0 comments on commit 60100e5

Please sign in to comment.