Compare commits
46 Commits
repo-clean
...
master
Author | SHA1 | Date | |
---|---|---|---|
836332cb75 | |||
dff19b33a0 | |||
f3aa5556ad | |||
b9719cbad0 | |||
3316304f3d | |||
2edc63c692 | |||
14beeea518 | |||
1f3f4c5c27 | |||
8251b20d08 | |||
4456c275cf | |||
cf66e90918 | |||
e3d9d28681 | |||
6a33698b0f | |||
6e9ca7331a | |||
f32be9efaa | |||
8c37f7b192 | |||
4bcc9c435b | |||
687afd20d3 | |||
7842eed5e7 | |||
01af118af1 | |||
dd06907fba | |||
7d33e4cc28 | |||
ccc49544b2 | |||
653f2d9c6d | |||
b762a59477 | |||
1af13b49eb | |||
afc7252292 | |||
2f77ba4249 | |||
ebaf81efbc | |||
44f820ff24 | |||
3f1ad29bb7 | |||
6731d71795 | |||
e27e029921 | |||
503ddfbcc4 | |||
|
c7bbd0119f | ||
|
1f24d456e0 | ||
|
c4e9cd0f1d | ||
|
2981665f1f | ||
|
d9f0c9ac45 | ||
|
eee88b403c | ||
|
25f962b5e1 | ||
|
0d954877e5 | ||
|
3a9b88700e | ||
|
d7a15dd12a | ||
|
d3334672ce | ||
|
302bbda11a |
15
.drone.yml
Normal file
15
.drone.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: docker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
registry: git.ericxliu.me
|
||||||
|
username: master
|
||||||
|
password: 1f8af4f82c0bd4dc24c1a03eaea6da13f54fed1c
|
||||||
|
repo: git.ericxliu.me/master/getting-started
|
||||||
|
tags: latest
|
||||||
|
platform: linux/amd64
|
||||||
|
custom_dns: [ 8.8.8.8 ]
|
||||||
|
mtu: 1450
|
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@ -1,12 +1,30 @@
|
|||||||
name: Build
|
name: Build and Push Docker Image
|
||||||
on: [push, pull_request]
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: ${{ github.repository_owner }}/${{ github.event.repository.name }}
|
||||||
|
DOCKER_HOST: tcp://docker.local:2375
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout repository
|
||||||
- name: Build
|
uses: actions/checkout@v4
|
||||||
uses: docker/build-push-action@v1
|
|
||||||
with:
|
with:
|
||||||
push: false
|
repository: ${{ github.repository }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Log in to the Docker registry
|
||||||
|
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login ${{ secrets.DOCKER_REGISTRY }} -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||||
|
|
||||||
|
- name: Build the Docker image
|
||||||
|
run: docker build -t ${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest .
|
||||||
|
|
||||||
|
- name: Push the Docker image
|
||||||
|
run: docker push ${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
34
Dockerfile
34
Dockerfile
@ -1,11 +1,33 @@
|
|||||||
# Install the base requirements for the app.
|
# Install the base requirements for the app.
|
||||||
# This stage is to support development.
|
# This stage is to support development.
|
||||||
FROM python:alpine AS base
|
ARG BUILDPLATFORM="linux/amd64"
|
||||||
|
ARG TARGETPLATFORM="linux/amd64"
|
||||||
|
|
||||||
|
FROM --platform=$BUILDPLATFORM python:alpine AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
|
|
||||||
FROM node:18-alpine AS app-base
|
RUN ping -c5 8.8.8.8
|
||||||
|
RUN ping -c5 208.67.222.222
|
||||||
|
RUN ifconfig
|
||||||
|
RUN uname -a
|
||||||
|
RUN cat /etc/resolv.conf
|
||||||
|
RUN route
|
||||||
|
RUN ip address
|
||||||
|
RUN ip route
|
||||||
|
RUN nslookup google.com
|
||||||
|
# RUN apk update
|
||||||
|
# RUN apk add --no-cache curl dig
|
||||||
|
# RUN dig https://google.com
|
||||||
|
# RUN curl -IL google.com
|
||||||
|
# RUN curl ifconfig.me
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN pip3 install --default-timeout=100 -r requirements.txt
|
||||||
|
|
||||||
|
FROM --platform=$BUILDPLATFORM node:18-alpine AS app-base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY app/package.json app/yarn.lock ./
|
COPY app/package.json app/yarn.lock ./
|
||||||
COPY app/spec ./spec
|
COPY app/spec ./spec
|
||||||
@ -25,16 +47,16 @@ RUN apk add zip && \
|
|||||||
zip -r /app.zip /app
|
zip -r /app.zip /app
|
||||||
|
|
||||||
# Dev-ready container - actual files will be mounted in
|
# Dev-ready container - actual files will be mounted in
|
||||||
FROM base AS dev
|
FROM --platform=$BUILDPLATFORM base AS dev
|
||||||
CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"]
|
CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"]
|
||||||
|
|
||||||
# Do the actual build of the mkdocs site
|
# Do the actual build of the mkdocs site
|
||||||
FROM base AS build
|
FROM --platform=$BUILDPLATFORM base AS build
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN mkdocs build
|
RUN mkdocs build
|
||||||
|
|
||||||
# Extract the static content from the build
|
# Extract the static content from the build
|
||||||
# and use a nginx image to serve the content
|
# and use a nginx image to serve the content
|
||||||
FROM nginx:alpine
|
FROM --platform=$TARGETPLATFORM nginx:alpine
|
||||||
COPY --from=app-zip-creator /app.zip /usr/share/nginx/html/assets/app.zip
|
COPY --from=app-zip-creator /app.zip /usr/share/nginx/html/assets/app.zip
|
||||||
COPY --from=build /app/site /usr/share/nginx/html
|
COPY --from=build /app/site /usr/share/nginx/html
|
||||||
|
@ -151,6 +151,8 @@ which ships with a _lot_ of tools that are useful for troubleshooting or debuggi
|
|||||||
What this means is... our app only simply needs to connect to a host named `mysql` and it'll talk to the
|
What this means is... our app only simply needs to connect to a host named `mysql` and it'll talk to the
|
||||||
database! It doesn't get much simpler than that!
|
database! It doesn't get much simpler than that!
|
||||||
|
|
||||||
|
When you're done, run `exit` to close out of the container.
|
||||||
|
|
||||||
|
|
||||||
## Running our App with MySQL
|
## Running our App with MySQL
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ see a few flaws in the Dockerfile below. But, don't worry! We'll go over them.
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN yarn install --production
|
RUN yarn install --production
|
||||||
CMD ["node", "src/index.js"]
|
CMD ["node", "./src/index.js"]
|
||||||
```
|
```
|
||||||
|
|
||||||
Please check that the file `Dockerfile` has no file extension like `.txt`. Some editors may append this file extension automatically and this would result in an error in the next step.
|
Please check that the file `Dockerfile` has no file extension like `.txt`. Some editors may append this file extension automatically and this would result in an error in the next step.
|
||||||
|
@ -34,7 +34,7 @@ To run our container to support a development workflow, we will do the following
|
|||||||
|
|
||||||
So, let's do it!
|
So, let's do it!
|
||||||
|
|
||||||
1. Make sure you don't have any previous `getting-started` containers running.
|
1. Make sure you don't have any of your own `getting-started` containers running (only the tutorial itself should be running).
|
||||||
|
|
||||||
1. Also make sure you are in app source code directory, i.e. `/path/to/getting-started/app`. If you aren't, you can `cd` into it, .e.g:
|
1. Also make sure you are in app source code directory, i.e. `/path/to/getting-started/app`. If you aren't, you can `cd` into it, .e.g:
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ another system, you can install Docker Compose using [the instructions here](htt
|
|||||||
|
|
||||||
## Creating our Compose File
|
## Creating our Compose File
|
||||||
|
|
||||||
1. At the root of the app project, create a file named `docker-compose.yml`.
|
1. Inside of the app folder, create a file named `docker-compose.yml` (next to the `Dockerfile` and `package.json` files).
|
||||||
|
|
||||||
1. In the compose file, we'll start off by defining a list of services (or containers) we want to run as part of our application.
|
1. In the compose file, we'll start off by defining a list of services (or containers) we want to run as part of our application.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user